CoordExecRPC.QueryContextInformation queryContextInformation = CoordExecRPC.QueryContextInformation.newBuilder (queryContextInfo) .setQueryMaxAllocation(wrapper.getMaxAllocation()).build(); .setCredentials(session.getCredentials()) .addAllCollector(CountRequiredFragments.getCollectors(root)) .setPriority(queryContextInfo.getPriority()) .setFragmentCodec(fragmentCodec) .addAllAllAssignment(assignments)
hash = (19 * hash) + getDescriptorForType().hashCode(); if (hasQueryStartTime()) { hash = (37 * hash) + QUERY_START_TIME_FIELD_NUMBER; hash = (53 * hash) + hashLong(getQueryStartTime()); if (hasTimeZone()) { hash = (37 * hash) + TIME_ZONE_FIELD_NUMBER; hash = (53 * hash) + getTimeZone(); if (hasDefaultSchemaName()) { hash = (37 * hash) + DEFAULT_SCHEMA_NAME_FIELD_NUMBER; hash = (53 * hash) + getDefaultSchemaName().hashCode(); if (hasPriority()) { hash = (37 * hash) + PRIORITY_FIELD_NUMBER; hash = (53 * hash) + getPriority().hashCode(); if (hasQueryMaxAllocation()) { hash = (37 * hash) + QUERY_MAX_ALLOCATION_FIELD_NUMBER; hash = (53 * hash) + hashLong(getQueryMaxAllocation()); if (hasExtra()) { hash = (37 * hash) + EXTRA_FIELD_NUMBER; hash = (53 * hash) + getExtra().hashCode(); hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash;
bitField0_ = (bitField0_ & ~0x00001000); if (contextBuilder_ == null) { context_ = com.dremio.exec.proto.CoordExecRPC.QueryContextInformation.getDefaultInstance(); } else { contextBuilder_.clear();
if (hasContext()) { result = result && getContext() .equals(other.getContext());
break; case 16: builder.setContext(input.mergeObject(com.dremio.exec.proto.CoordExecRPC.QueryContextInformation.newBuilder(), com.dremio.exec.proto.SchemaCoordExecRPC.QueryContextInformation.MERGE));
options.getOption(BasicResourceConstants.LARGE_QUEUE_MEMORY_LIMIT); if (memoryControlEnabled && memoryLimit > 0) { final long queryMaxAllocation = queryContext.getQueryContextInfo().getQueryMaxAllocation(); queryContextInformation = CoordExecRPC.QueryContextInformation.newBuilder(queryContextInformation) .setQueryMaxAllocation(Math.min(memoryLimit, queryMaxAllocation)).build();
resourceSchedulingDecisionInfo.setQueueName(queueType.name()); resourceSchedulingDecisionInfo.setQueueId(queueType.name()); resourceSchedulingDecisionInfo.setWorkloadClass(queryContext.getQueryContextInfo().getPriority().getWorkloadClass()); options.getOption(BasicResourceConstants.SMALL_QUEUE_MEMORY_LIMIT): options.getOption(BasicResourceConstants.LARGE_QUEUE_MEMORY_LIMIT); long queryMaxAllocation = queryContext.getQueryContextInfo().getQueryMaxAllocation(); if (memoryControlEnabled && memoryLimit > 0) { queryMaxAllocation = Math.min(memoryLimit, queryMaxAllocation);
result = result && (hasQueryStartTime() == other.hasQueryStartTime()); if (hasQueryStartTime()) { result = result && (getQueryStartTime() == other.getQueryStartTime()); result = result && (hasTimeZone() == other.hasTimeZone()); if (hasTimeZone()) { result = result && (getTimeZone() == other.getTimeZone()); result = result && (hasDefaultSchemaName() == other.hasDefaultSchemaName()); if (hasDefaultSchemaName()) { result = result && getDefaultSchemaName() .equals(other.getDefaultSchemaName()); result = result && (hasPriority() == other.hasPriority()); if (hasPriority()) { result = result && getPriority() .equals(other.getPriority()); result = result && (hasQueryMaxAllocation() == other.hasQueryMaxAllocation()); if (hasQueryMaxAllocation()) { result = result && (getQueryMaxAllocation() == other.getQueryMaxAllocation()); result = result && (hasExtra() == other.hasExtra()); if (hasExtra()) { result = result && getExtra() .equals(other.getExtra());
public com.dremio.exec.proto.CoordExecRPC.QueryContextInformation buildPartial() { com.dremio.exec.proto.CoordExecRPC.QueryContextInformation result = new com.dremio.exec.proto.CoordExecRPC.QueryContextInformation(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0;
/** * Create QueryContextInformation with given <i>defaultSchemaName</i>. Rest of the members of the * QueryContextInformation is derived from the current state of the process. * * @param defaultSchemaName * @return */ public static QueryContextInformation createQueryContextInfo(final String defaultSchemaName, QueryPriority priority, long maxAllocation) { final long queryStartTime = System.currentTimeMillis(); final int timeZone = DateUtility.getIndex(System.getProperty("user.timezone")); FragmentPriority.Builder priorityBuilder = FragmentPriority.newBuilder(); if(priority != null){ priorityBuilder.setWorkloadClass(priority.getWorkloadClass()); } else { priorityBuilder.setWorkloadClass(WorkloadClass.GENERAL); } return QueryContextInformation.newBuilder() .setDefaultSchemaName(defaultSchemaName) .setQueryStartTime(queryStartTime) .setTimeZone(timeZone) .setPriority(priorityBuilder) .setQueryMaxAllocation(maxAllocation) .build(); }
public Builder mergeFrom(com.dremio.exec.proto.CoordExecRPC.QueryContextInformation other) { if (other == com.dremio.exec.proto.CoordExecRPC.QueryContextInformation.getDefaultInstance()) return this; if (other.hasQueryStartTime()) { setQueryStartTime(other.getQueryStartTime()); } if (other.hasTimeZone()) { setTimeZone(other.getTimeZone()); } if (other.hasDefaultSchemaName()) { bitField0_ |= 0x00000004; defaultSchemaName_ = other.defaultSchemaName_; onChanged(); } if (other.hasPriority()) { mergePriority(other.getPriority()); } if (other.hasQueryMaxAllocation()) { setQueryMaxAllocation(other.getQueryMaxAllocation()); } if (other.hasExtra()) { setExtra(other.getExtra()); } this.mergeUnknownFields(other.getUnknownFields()); return this; }
private void initFields() { handle_ = com.dremio.exec.proto.ExecProtos.FragmentHandle.getDefaultInstance(); networkCost_ = 0F; cpuCost_ = 0F; diskCost_ = 0F; memoryCost_ = 0F; fragmentJson_ = com.google.protobuf.ByteString.EMPTY; leafFragment_ = false; assignment_ = com.dremio.exec.proto.CoordinationProtos.NodeEndpoint.getDefaultInstance(); foreman_ = com.dremio.exec.proto.CoordinationProtos.NodeEndpoint.getDefaultInstance(); memInitial_ = 20000000L; memMax_ = 2000000000L; credentials_ = com.dremio.exec.proto.UserBitShared.UserCredentials.getDefaultInstance(); optionsJson_ = com.google.protobuf.ByteString.EMPTY; context_ = com.dremio.exec.proto.CoordExecRPC.QueryContextInformation.getDefaultInstance(); collector_ = java.util.Collections.emptyList(); priority_ = com.dremio.exec.proto.CoordExecRPC.FragmentPriority.getDefaultInstance(); fragmentCodec_ = com.dremio.exec.proto.CoordExecRPC.FragmentCodec.NONE; allAssignment_ = java.util.Collections.emptyList(); } private byte memoizedIsInitialized = -1;
public void setup() { try { storeProvider = new LocalKVStoreProvider(DremioTest.CLASSPATH_SCAN_RESULT, null, true, false); storeProvider.start(); final Provider<KVStoreProvider> storeProviderProvider = new Provider<KVStoreProvider>() { @Override public KVStoreProvider get() { return storeProvider; } }; provider = new KVPersistentStoreProvider(storeProviderProvider); options = new SystemOptionManager(result, persistence, provider); options.init(); compiler = new CodeCompiler(config, options); ec = new ExecutionControls(options, NodeEndpoint.getDefaultInstance()); functionLookup = new FunctionImplementationRegistry(config, result); contextInformation = new ContextInformationImpl(UserCredentials.getDefaultInstance(), QueryContextInformation.getDefaultInstance()); }catch(Exception e){ throw new RuntimeException(e); } }
/** * <code>optional .exec.bit.control.QueryContextInformation context = 16;</code> */ public Builder mergeContext(com.dremio.exec.proto.CoordExecRPC.QueryContextInformation value) { if (contextBuilder_ == null) { if (((bitField0_ & 0x00002000) == 0x00002000) && context_ != com.dremio.exec.proto.CoordExecRPC.QueryContextInformation.getDefaultInstance()) { context_ = com.dremio.exec.proto.CoordExecRPC.QueryContextInformation.newBuilder(context_).mergeFrom(value).buildPartial(); } else { context_ = value; } onChanged(); } else { contextBuilder_.mergeFrom(value); } bitField0_ |= 0x00002000; return this; } /**
public Builder toBuilder() { return newBuilder(this); }
/** * Builds and starts a new query, if sufficient resources are available. * In case resources are not available immediately, the query will be started later, when resources become available */ public void buildAndStartQuery(final PlanFragment firstFragment, final SchedulingInfo schedulingInfo, final QueryStarter queryStarter) { final QueryId queryId = firstFragment.getHandle().getQueryId(); // Note: The temporary reference count (released in the finally clause, below) is necessary to guard against races // between potential workload ticket modifications and this function (creation of fragments for queries on the workload) WorkloadTicket workloadTicket = workloadTicketDepot.getWorkloadTicket(schedulingInfo); try { final long queryMaxAllocation = workloadTicket.getChildMaxAllocation(firstFragment.getContext().getQueryMaxAllocation()); workloadTicket.buildAndStartQuery(queryId, queryMaxAllocation, firstFragment.getForeman(), firstFragment.getAssignment(), tunnelCreator, queryStarter); } finally { workloadTicket.release(); } }
public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(com.dremio.exec.proto.CoordExecRPC.QueryContextInformation prototype) {
public com.dremio.exec.proto.CoordExecRPC.QueryContextInformation getDefaultInstanceForType() { return com.dremio.exec.proto.CoordExecRPC.QueryContextInformation.getDefaultInstance(); }
protected QueueType getQueueNameFromSchedulingProperties(final ResourceSchedulingContext queryContext, final ResourceSchedulingProperties resourceSchedulingProperties) { final Double cost = resourceSchedulingProperties.getQueryCost(); Preconditions.checkNotNull(cost, "Queue Cost is not provided, Unable to determine " + "queue."); final long queueThreshold = queryContext.getOptions().getOption(BasicResourceConstants.QUEUE_THRESHOLD_SIZE); final QueueType queueType; if (queryContext.getQueryContextInfo().getPriority().getWorkloadClass().equals(UserBitShared.WorkloadClass.BACKGROUND)) { queueType = (cost > queueThreshold) ? QueueType.REFLECTION_LARGE : QueueType.REFLECTION_SMALL; } else { queueType = (cost > queueThreshold) ? QueueType.LARGE : QueueType.SMALL; } return queueType; }
public void writeTo(io.protostuff.Output output, com.dremio.exec.proto.CoordExecRPC.QueryContextInformation message) throws java.io.IOException { if(message.hasQueryStartTime()) output.writeInt64(1, message.getQueryStartTime(), false); if(message.hasTimeZone()) output.writeInt32(2, message.getTimeZone(), false); if(message.hasDefaultSchemaName()) output.writeString(3, message.getDefaultSchemaName(), false); if(message.hasPriority()) output.writeObject(4, message.getPriority(), com.dremio.exec.proto.SchemaCoordExecRPC.FragmentPriority.WRITE, false); if(message.hasQueryMaxAllocation()) output.writeInt64(5, message.getQueryMaxAllocation(), false); if(message.hasExtra()) output.writeByteArray(6, message.getExtra().toByteArray(), false); } public boolean isInitialized(com.dremio.exec.proto.CoordExecRPC.QueryContextInformation message)