@Override public ILogicalOperator visitDistributeResultOperator(DistributeResultOperator op, Void arg) throws AlgebricksException { ArrayList<Mutable<ILogicalExpression>> newExpressions = new ArrayList<>(); deepCopyExpressionRefs(newExpressions, op.getExpressions()); return new DistributeResultOperator(newExpressions, op.getDataSink()); }
@Override public Long visitDistributeResultOperator(DistributeResultOperator op, Void arg) throws AlgebricksException { return op.getInputs().get(0).getValue().accept(this, arg); }
@Override public IVariableTypeEnvironment computeOutputTypeEnvironment(ITypingContext ctx) throws AlgebricksException { return createPropagatingAllInputsTypeEnvironment(ctx); }
@Test public void noBlockingPlan() throws AlgebricksException { EmptyTupleSourceOperator ets = new EmptyTupleSourceOperator(); ets.setExecutionMode(UNPARTITIONED); AssignOperator assignOperator = new AssignOperator(Collections.emptyList(), null); assignOperator.setExecutionMode(UNPARTITIONED); assignOperator.getInputs().add(new MutableObject<>(ets)); ExchangeOperator exchange = new ExchangeOperator(); exchange.setExecutionMode(UNPARTITIONED); exchange.setPhysicalOperator(new OneToOneExchangePOperator()); exchange.getInputs().add(new MutableObject<>(assignOperator)); DistributeResultOperator resultOperator = new DistributeResultOperator(null, null); resultOperator.setExecutionMode(UNPARTITIONED); resultOperator.getInputs().add(new MutableObject<>(exchange)); ALogicalPlanImpl plan = new ALogicalPlanImpl(Collections.singletonList(new MutableObject(resultOperator))); List<PlanStage> stages = ResourceUtils.getStages(plan); // ensure a single stage plan final int expectedStages = 1; Assert.assertEquals(expectedStages, stages.size()); validateStages(stages, resultOperator, exchange, ets, assignOperator); // frame size for every operator final long expectedMemory = stages.get(0).getOperators().size() * FRAME_SIZE; assertRequiredMemory(stages, expectedMemory); }
ResultSetSinkId rssId = new ResultSetSinkId(metadataProvider.getResultSetId()); ResultSetDataSink sink = new ResultSetDataSink(rssId, null); DistributeResultOperator distResultOperator = new DistributeResultOperator(expressions, sink); distResultOperator.getInputs().add(new MutableObject<>(createResultAssignOperator)); distResultOperator.setSourceLocation(sourceLoc); return distResultOperator;
int[] columns = new int[resultOp.getExpressions().size()]; int i = 0; for (Mutable<ILogicalExpression> exprRef : resultOp.getExpressions()) { ILogicalExpression expr = exprRef.getValue(); if (expr.getExpressionTag() != LogicalExpressionTag.VARIABLE) { mp.getResultHandleRuntime(resultOp.getDataSink(), columns, pf, inputDesc, true, spec); IOperatorDescriptor opDesc = runtimeAndConstraints.first; opDesc.setSourceLocation(resultOp.getSourceLocation()); builder.contributeHyracksOperator(resultOp, opDesc); ILogicalOperator src = resultOp.getInputs().get(0).getValue(); builder.contributeGraphEdge(src, 0, resultOp, 0);
private ILogicalPlan translateMainModule(MainModuleNode moduleNode) throws SystemException { QueryBodyNode qbn = moduleNode.getQueryBody(); ASTNode queryBody = qbn.getExpression(); TranslationContext tCtx = new TranslationContext(null, new EmptyTupleSourceOperator()); LogicalVariable lVar = translateExpression(queryBody, tCtx); LogicalVariable iLVar = newLogicalVariable(); UnnestOperator unnest = new UnnestOperator(iLVar, mutable(ufce(BuiltinOperators.ITERATE, vre(lVar)))); unnest.getInputs().add(mutable(tCtx.op)); List<Mutable<ILogicalExpression>> exprs = new ArrayList<Mutable<ILogicalExpression>>(); exprs.add(mutable(vre(iLVar))); QueryResultSetDataSink sink = new QueryResultSetDataSink(ccb.getResultSetId(), null); DistributeResultOperator op = new DistributeResultOperator(exprs, sink); op.getInputs().add(mutable(unnest)); ALogicalPlanImpl lp = new ALogicalPlanImpl(mutable(op)); return lp; }
@Override public Void visitDistributeResultOperator(DistributeResultOperator op, Void arg) { for (Mutable<ILogicalExpression> expr : op.getExpressions()) { expr.getValue().getUsedVariables(usedVariables); } return null; }
@Override public Boolean visitDistributeResultOperator(DistributeResultOperator op, ILogicalOperator arg) throws AlgebricksException { AbstractLogicalOperator aop = (AbstractLogicalOperator) arg; if (aop.getOperatorTag() != LogicalOperatorTag.DISTRIBUTE_RESULT) { return Boolean.FALSE; } DistributeResultOperator writeOpArg = (DistributeResultOperator) copyAndSubstituteVar(op, arg); boolean isomorphic = VariableUtilities.varListEqualUnordered(op.getSchema(), writeOpArg.getSchema()); return isomorphic; }
@Override public PhysicalRequirements getRequiredPropertiesForChildren(ILogicalOperator op, IPhysicalPropertiesVector reqdByParent, IOptimizationContext context) { DistributeResultOperator write = (DistributeResultOperator) op; IDataSink sink = write.getDataSink(); IPartitioningProperty pp = sink.getPartitioningProperty(); StructuralPropertiesVector[] r = new StructuralPropertiesVector[] { new StructuralPropertiesVector(pp, null) }; return new PhysicalRequirements(r, IPartitioningRequirementsCoordinator.NO_COORDINATION); }
orderOperator.getInputs().add(new MutableObject<>(groupByOperator)); DistributeResultOperator resultOperator = new DistributeResultOperator(null, null); resultOperator.setExecutionMode(PARTITIONED); resultOperator.getInputs().add(new MutableObject<>(orderOperator)); ALogicalPlanImpl plan = new ALogicalPlanImpl(Collections.singletonList(new MutableObject(resultOperator)));
ResultSetSinkId rssId = new ResultSetSinkId(metadataProvider.getResultSetId()); ResultSetDataSink sink = new ResultSetDataSink(rssId, null); DistributeResultOperator newTop = new DistributeResultOperator(writeExprList, sink); newTop.setSourceLocation(sourceLoc); newTop.getInputs().add(new MutableObject<>(topOp)); topOp = newTop;
@Override public Void visitDistributeResultOperator(DistributeResultOperator op, Integer indent) throws AlgebricksException { addIndent(indent).append("\"operator\": \"distribute-result\""); if (!op.getExpressions().isEmpty()) { addIndent(0).append(",\n"); pprintExprList(op.getExpressions(), indent); } return null; }
secondJoin.getInputs().add(new MutableObject<>(order2)); DistributeResultOperator resultOperator = new DistributeResultOperator(null, null); resultOperator.setExecutionMode(PARTITIONED); resultOperator.getInputs().add(new MutableObject<>(secondJoin)); ALogicalPlanImpl plan = new ALogicalPlanImpl(Collections.singletonList(new MutableObject(resultOperator)));
@Override public String visitDistributeResultOperator(DistributeResultOperator op, Boolean showDetails) { stringBuilder.setLength(0); stringBuilder.append("distribute result "); printExprList(op.getExpressions()); appendSchema(op, showDetails); appendAnnotations(op, showDetails); appendPhysicalOperatorInfo(op, showDetails); return stringBuilder.toString(); }
secondJoin.getInputs().add(new MutableObject<>(exchangeOperator2)); DistributeResultOperator resultOperator = new DistributeResultOperator(null, null); resultOperator.setExecutionMode(PARTITIONED); resultOperator.getInputs().add(new MutableObject<>(secondJoin)); ALogicalPlanImpl plan = new ALogicalPlanImpl(Collections.singletonList(new MutableObject(resultOperator)));
@Override public Void visitDistributeResultOperator(DistributeResultOperator op, Integer indent) throws AlgebricksException { addIndent(indent).append("distribute result "); pprintExprList(op.getExpressions(), indent); return null; }
@Override public Void visitDistributeResultOperator(DistributeResultOperator op, Pair<LogicalVariable, LogicalVariable> pair) throws AlgebricksException { for (Mutable<ILogicalExpression> e : op.getExpressions()) { e.getValue().substituteVar(pair.first, pair.second); } substVarTypes(op, pair); return null; }
recordVar = ((VariableReferenceExpression) ((DistributeResultOperator) op).getExpressions().get(0) .getValue()).getVariableReference(); break;