/** * <code>optional .exec.shared.UserCredentials credentials = 4;</code> */ public Builder setCredentials( com.dremio.exec.proto.UserBitShared.UserCredentials.Builder builderForValue) { if (credentialsBuilder_ == null) { credentials_ = builderForValue.build(); onChanged(); } else { credentialsBuilder_.setMessage(builderForValue.build()); } bitField0_ |= 0x00000008; return this; } /**
/** * <code>optional .exec.shared.UserCredentials credentials = 14;</code> */ public Builder setCredentials( com.dremio.exec.proto.UserBitShared.UserCredentials.Builder builderForValue) { if (credentialsBuilder_ == null) { credentials_ = builderForValue.build(); onChanged(); } else { credentialsBuilder_.setMessage(builderForValue.build()); } bitField0_ |= 0x00000800; return this; } /**
private UserBitShared.UserCredentials getUserCredentials() { // If username is not propagated as one of the properties String userName = "anonymous"; if (props != null) { for (Property property: props.getPropertiesList()) { if (property.getKey().equalsIgnoreCase("user") && !Strings.isNullOrEmpty(property.getValue())) { userName = property.getValue(); break; } } } return UserBitShared.UserCredentials.newBuilder().setUserName(userName).build(); }
.withCredentials(UserCredentials.newBuilder() .setUserName("foo") .build()) .withUserProperties(UserProperties.getDefaultInstance()) .withOptionManager(nodeContext1.getOptionManager())
.withCredentials(UserBitShared.UserCredentials.newBuilder().setUserName("foo").build()) .withUserProperties(UserProperties.getDefaultInstance()) .withOptionManager(nodeContext1.getOptionManager())
.withCredentials(UserBitShared.UserCredentials.newBuilder() .setUserName(username) .build()) .withUserProperties(UserProtos.UserProperties.getDefaultInstance()) .withOptionManager(sabotContext.getOptionManager())
@Override public void submitLocalQuery( ExternalId externalId, QueryObserver observer, Object query, boolean prepare, LocalExecutionConfig config) { try{ // make sure we keep a local observer out of band. final QueryObserver oobJobObserver = new OutOfBandQueryObserver(observer, executor); UserSession session = UserSession.Builder.newBuilder() .setSupportComplexTypes(true) .withCredentials(UserCredentials .newBuilder() .setUserName(config.getUsername()) .build()) .exposeInternalSources(config.isExposingInternalSources()) .withDefaultSchema(config.getSqlContext()) .withSubstitutionSettings(config.getSubstitutionSettings()) .withOptionManager(options) .withClientInfos(UserRpcUtils.getRpcEndpointInfos("Dremio Java local client")) .build(); final ReAttemptHandler attemptHandler = newInternalAttemptHandler(options, config.isFailIfNonEmptySent()); submit(externalId, oobJobObserver, session, new UserRequest(prepare ? RpcType.CREATE_PREPARED_STATEMENT : RpcType.RUN_QUERY, query), TerminationListenerRegistry.NOOP, config, attemptHandler); }catch(Exception ex){ throw Throwables.propagate(ex); } } }
private void print(String fragmentFile, int bitCount, int expectedFragmentCount) throws Exception{ System.out.println(String.format("=================Building plan fragments for [%s]. Allowing %d total Nodes.==================", fragmentFile, bitCount)); PhysicalPlanReader ppr = PhysicalPlanReaderTestFactory.defaultPhysicalPlanReader(DEFAULT_SABOT_CONFIG, CLASSPATH_SCAN_RESULT); Fragment fragmentRoot = getRootFragment(ppr, fragmentFile); SimpleParallelizer par = new SimpleParallelizer(1000*1000, 5, 10, 1.2, AbstractAttemptObserver.NOOP, true, 1.5d); List<NodeEndpoint> endpoints = Lists.newArrayList(); NodeEndpoint localBit = null; for(int i =0; i < bitCount; i++) { NodeEndpoint b1 = NodeEndpoint.newBuilder().setAddress("localhost").setFabricPort(1234+i).build(); if (i == 0) { localBit = b1; } endpoints.add(b1); } final QueryContextInformation queryContextInfo = Utilities.createQueryContextInfo("dummySchemaName"); List<PlanFragment> qwu = par.getFragments(new OptionList(), localBit, QueryId.getDefaultInstance(), endpoints, ppr, fragmentRoot, UserSession.Builder.newBuilder().withCredentials(UserBitShared.UserCredentials.newBuilder().setUserName("foo").build()).build(), queryContextInfo, null); assertEquals(expectedFragmentCount, qwu.size() + 1 /* root fragment is not part of the getFragments() list*/); }
private QueryContext newQueryContext(SqlQuery query) { try (TimedBlock b = time("initParser")) { QueryId queryId = QueryId.newBuilder().setPart1(ID_MAJOR).setPart2(ID_MINOR.incrementAndGet()).build(); UserSession session = UserSession.Builder.newBuilder() .withCredentials(UserCredentials.newBuilder() .setUserName(query.getUsername()) .build()) .withUserProperties(UserProperties.getDefaultInstance()) .withOptionManager(sabotContext.getOptionManager()) .build(); return new QueryContext(session, sabotContext, queryId); } }
private static UserSession session() { return UserSession.Builder.newBuilder() .withUserProperties(UserProtos.UserProperties.getDefaultInstance()) .withCredentials(UserBitShared.UserCredentials.newBuilder().setUserName("foo").build()) .withOptionManager(getSabotContext().getOptionManager()) .setSupportComplexTypes(true) .build(); } }
private static UserSession session() { return UserSession.Builder.newBuilder() .withUserProperties(UserProtos.UserProperties.getDefaultInstance()) .withCredentials(UserBitShared.UserCredentials.newBuilder().setUserName("foo").build()) .withOptionManager(getSabotContext().getOptionManager()) .setSupportComplexTypes(true) .build(); }
private static UserSession systemSession(OptionManager options) { final UserBitShared.UserCredentials credentials = UserBitShared.UserCredentials.newBuilder() .setUserName(SYSTEM_USERNAME) .build(); return UserSession.Builder.newBuilder() .withCredentials(credentials) .withOptionManager(options) .exposeInternalSources(true) .build(); }
public static UserSession session() { return UserSession.Builder.newBuilder() .withUserProperties(UserProtos.UserProperties.getDefaultInstance()) .withCredentials(UserBitShared.UserCredentials.newBuilder().setUserName("foo").build()) .withOptionManager(getSabotContext().getOptionManager()) .setSupportComplexTypes(true) .build(); }