public SessionPropertyManager() { this(new SystemSessionProperties()); }
public FullConnectorSession(Session session, ConnectorIdentity identity) { this.session = requireNonNull(session, "session is null"); this.identity = requireNonNull(identity, "identity is null"); this.properties = null; this.connectorId = null; this.catalog = null; this.sessionPropertyManager = null; this.isLegacyTimestamp = SystemSessionProperties.isLegacyTimestamp(session); }
private static boolean isHashEnabled(Session session) { return SystemSessionProperties.isOptimizeHashGenerationEnabled(session); }
protected final OperatorFactory createHashProjectOperator(int operatorId, PlanNodeId planNodeId, List<Type> types) { ImmutableMap.Builder<Symbol, Type> symbolTypes = ImmutableMap.builder(); ImmutableMap.Builder<Symbol, Integer> symbolToInputMapping = ImmutableMap.builder(); ImmutableList.Builder<PageProjection> projections = ImmutableList.builder(); for (int channel = 0; channel < types.size(); channel++) { Symbol symbol = new Symbol("h" + channel); symbolTypes.put(symbol, types.get(channel)); symbolToInputMapping.put(symbol, channel); projections.add(new InputPageProjection(channel, types.get(channel))); } Optional<Expression> hashExpression = HashGenerationOptimizer.getHashExpression(ImmutableList.copyOf(symbolTypes.build().keySet())); verify(hashExpression.isPresent()); projections.add(new InterpretedPageProjection( hashExpression.get(), TypeProvider.copyOf(symbolTypes.build()), symbolToInputMapping.build(), localQueryRunner.getMetadata(), localQueryRunner.getSqlParser(), session)); return new FilterAndProjectOperator.FilterAndProjectOperatorFactory( operatorId, planNodeId, () -> new PageProcessor(Optional.empty(), projections.build()), ImmutableList.copyOf(Iterables.concat(types, ImmutableList.of(BIGINT))), getFilterAndProjectMinOutputPageSize(session), getFilterAndProjectMinOutputPageRowCount(session)); }
public static RowExpression translate( Expression expression, FunctionKind functionKind, Map<NodeRef<Expression>, Type> types, FunctionRegistry functionRegistry, TypeManager typeManager, Session session, boolean optimize) { Visitor visitor = new Visitor( functionKind, types, typeManager, session.getTimeZoneKey(), isLegacyRowFieldOrdinalAccessEnabled(session), SystemSessionProperties.isLegacyTimestamp(session)); RowExpression result = visitor.process(expression, null); requireNonNull(result, "translated expression is null"); if (optimize) { ExpressionOptimizer optimizer = new ExpressionOptimizer(functionRegistry, typeManager, session); return optimizer.optimize(result); } return result; }
private static TaskHandle createTaskHandle( TaskStateMachine taskStateMachine, TaskContext taskContext, OutputBuffer outputBuffer, LocalExecutionPlan localExecutionPlan, TaskExecutor taskExecutor) { TaskHandle taskHandle = taskExecutor.addTask( taskStateMachine.getTaskId(), outputBuffer::getUtilization, getInitialSplitsPerNode(taskContext.getSession()), getSplitConcurrencyAdjustmentInterval(taskContext.getSession()), getMaxDriversPerTask(taskContext.getSession())); taskStateMachine.addStateChangeListener(state -> { if (state.isDone()) { taskExecutor.removeTask(taskHandle); for (DriverFactory factory : localExecutionPlan.getDriverFactories()) { factory.noMoreDrivers(); } } }); return taskHandle; }
if (plan.getSubStages().isEmpty()) { boolean preferDynamic = groupedExecutionForStage && isDynamicSchduleForGroupedExecution(session); bucketNodeMap = nodePartitioningManager.getBucketNodeMap(session, partitioningHandle, preferDynamic); if (bucketNodeMap.isDynamic()) { bucketNodeMap, splitBatchSize, getConcurrentLifespansPerNode(session), nodeScheduler.createNodeSelector(connectorId), connectorPartitionHandles)); nodeScheduler.createNodeSelector(null), schedulerExecutor, getWriterMinSize(session)); whenAllStages(childStages, StageState::isDone) .addListener(scheduler::finish, directExecutor());
@Override public PhysicalOperation visitAggregation(AggregationNode node, LocalExecutionPlanContext context) { PhysicalOperation source = node.getSource().accept(this, context); if (node.getGroupingKeys().isEmpty()) { return planGlobalAggregation(node, source, context); } boolean spillEnabled = isSpillEnabled(context.getSession()); DataSize unspillMemoryLimit = getAggregationOperatorUnspillMemoryLimit(context.getSession()); return planGroupByAggregation(node, source, spillEnabled, unspillMemoryLimit, context); }
public int estimateHashedTaskCount(Session session) { return min(numberOfNodes.getAsInt(), getHashPartitionCount(session)); } }
WarningCollector warningCollector) String executionPolicyName = SystemSessionProperties.getExecutionPolicy(session); ExecutionPolicy executionPolicy = executionPolicies.get(executionPolicyName); checkArgument(executionPolicy != null, "No execution policy %s", executionPolicy);
protected final OperatorFactory createHashProjectOperator(int operatorId, PlanNodeId planNodeId, List<Type> types) { ImmutableMap.Builder<Symbol, Type> symbolTypes = ImmutableMap.builder(); ImmutableMap.Builder<Symbol, Integer> symbolToInputMapping = ImmutableMap.builder(); ImmutableList.Builder<PageProjection> projections = ImmutableList.builder(); for (int channel = 0; channel < types.size(); channel++) { Symbol symbol = new Symbol("h" + channel); symbolTypes.put(symbol, types.get(channel)); symbolToInputMapping.put(symbol, channel); projections.add(new InputPageProjection(channel, types.get(channel))); } Optional<Expression> hashExpression = HashGenerationOptimizer.getHashExpression(ImmutableList.copyOf(symbolTypes.build().keySet())); verify(hashExpression.isPresent()); projections.add(new InterpretedPageProjection( hashExpression.get(), TypeProvider.copyOf(symbolTypes.build()), symbolToInputMapping.build(), localQueryRunner.getMetadata(), localQueryRunner.getSqlParser(), session)); return new FilterAndProjectOperator.FilterAndProjectOperatorFactory( operatorId, planNodeId, () -> new PageProcessor(Optional.empty(), projections.build()), ImmutableList.copyOf(Iterables.concat(types, ImmutableList.of(BIGINT))), getFilterAndProjectMinOutputPageSize(session), getFilterAndProjectMinOutputPageRowCount(session)); }
public static RowExpression translate( Expression expression, FunctionKind functionKind, Map<NodeRef<Expression>, Type> types, FunctionRegistry functionRegistry, TypeManager typeManager, Session session, boolean optimize) { Visitor visitor = new Visitor( functionKind, types, typeManager, session.getTimeZoneKey(), isLegacyRowFieldOrdinalAccessEnabled(session), SystemSessionProperties.isLegacyTimestamp(session)); RowExpression result = visitor.process(expression, null); requireNonNull(result, "translated expression is null"); if (optimize) { ExpressionOptimizer optimizer = new ExpressionOptimizer(functionRegistry, typeManager, session); return optimizer.optimize(result); } return result; }
private static TaskHandle createTaskHandle( TaskStateMachine taskStateMachine, TaskContext taskContext, OutputBuffer outputBuffer, LocalExecutionPlan localExecutionPlan, TaskExecutor taskExecutor) { TaskHandle taskHandle = taskExecutor.addTask( taskStateMachine.getTaskId(), outputBuffer::getUtilization, getInitialSplitsPerNode(taskContext.getSession()), getSplitConcurrencyAdjustmentInterval(taskContext.getSession()), getMaxDriversPerTask(taskContext.getSession())); taskStateMachine.addStateChangeListener(state -> { if (state.isDone()) { taskExecutor.removeTask(taskHandle); for (DriverFactory factory : localExecutionPlan.getDriverFactories()) { factory.noMoreDrivers(); } } }); return taskHandle; }
if (plan.getSubStages().isEmpty()) { boolean preferDynamic = groupedExecutionForStage && isDynamicSchduleForGroupedExecution(session); bucketNodeMap = nodePartitioningManager.getBucketNodeMap(session, partitioningHandle, preferDynamic); if (bucketNodeMap.isDynamic()) { bucketNodeMap, splitBatchSize, getConcurrentLifespansPerNode(session), nodeScheduler.createNodeSelector(connectorId), connectorPartitionHandles)); nodeScheduler.createNodeSelector(null), schedulerExecutor, getWriterMinSize(session)); whenAllStages(childStages, StageState::isDone) .addListener(scheduler::finish, directExecutor());
@Override public PhysicalOperation visitAggregation(AggregationNode node, LocalExecutionPlanContext context) { PhysicalOperation source = node.getSource().accept(this, context); if (node.getGroupingKeys().isEmpty()) { return planGlobalAggregation(node, source, context); } boolean spillEnabled = isSpillEnabled(context.getSession()); DataSize unspillMemoryLimit = getAggregationOperatorUnspillMemoryLimit(context.getSession()); return planGroupByAggregation(node, source, spillEnabled, unspillMemoryLimit, context); }
public NodePartitionMap getNodePartitionMap(Session session, NodeScheduler nodeScheduler) { NodeSelector nodeSelector = nodeScheduler.createNodeSelector(null); List<Node> nodes; if (partitioning == SystemPartitioning.COORDINATOR_ONLY) { nodes = ImmutableList.of(nodeSelector.selectCurrentNode()); } else if (partitioning == SystemPartitioning.SINGLE) { nodes = nodeSelector.selectRandomNodes(1); } else if (partitioning == SystemPartitioning.FIXED) { nodes = nodeSelector.selectRandomNodes(getHashPartitionCount(session)); } else { throw new IllegalArgumentException("Unsupported plan distribution " + partitioning); } checkCondition(!nodes.isEmpty(), NO_NODES_AVAILABLE, "No worker nodes available"); return new NodePartitionMap(nodes, split -> { throw new UnsupportedOperationException("System distribution does not support source splits"); }); }
WarningCollector warningCollector) String executionPolicyName = SystemSessionProperties.getExecutionPolicy(session); ExecutionPolicy executionPolicy = executionPolicies.get(executionPolicyName); checkArgument(executionPolicy != null, "No execution policy %s", executionPolicy);
columns, getTypes(rewrittenProjections, expressionTypes), getFilterAndProjectMinOutputPageSize(session), getFilterAndProjectMinOutputPageRowCount(session)); pageProcessor, getTypes(rewrittenProjections, expressionTypes), getFilterAndProjectMinOutputPageSize(session), getFilterAndProjectMinOutputPageRowCount(session));
public FullConnectorSession(Session session, ConnectorIdentity identity) { this.session = requireNonNull(session, "session is null"); this.identity = requireNonNull(identity, "identity is null"); this.properties = null; this.connectorId = null; this.catalog = null; this.sessionPropertyManager = null; this.isLegacyTimestamp = SystemSessionProperties.isLegacyTimestamp(session); }
public SessionPropertyManager() { this(new SystemSessionProperties()); }