Assignments.Builder assignments = Assignments.builder(); aggregationArguments.forEach(assignments::putIdentity); groupingSetMappings.forEach((key, value) -> assignments.put(key, value.toSymbolReference())); ProjectNode project = new ProjectNode(idAllocator.getNextId(), subPlan.getRoot(), assignments.build()); subPlan = new PlanBuilder(groupingTranslations, project, analysis.getParameters());
leftCoercions.putIdentities(left.getRoot().getOutputSymbols()); rightCoercions.putIdentities(right.getRoot().getOutputSymbols()); for (int i = 0; i < joinColumns.size(); i++) { Identifier identifier = joinColumns.get(i); leftCoercions.put(leftOutput, new Cast( left.getSymbol(leftField).toSymbolReference(), type.getTypeSignature().toString(), rightCoercions.put(rightOutput, new Cast( right.getSymbol(rightField).toSymbolReference(), type.getTypeSignature().toString(), ProjectNode leftCoercion = new ProjectNode(idAllocator.getNextId(), left.getRoot(), leftCoercions.build()); ProjectNode rightCoercion = new ProjectNode(idAllocator.getNextId(), right.getRoot(), rightCoercions.build()); Symbol output = symbolAllocator.newSymbol(column, analysis.getType(column)); outputs.add(output); assignments.put(output, new CoalesceExpression( leftJoinColumns.get(column).toSymbolReference(), rightJoinColumns.get(column).toSymbolReference())); Symbol symbol = left.getFieldMappings().get(field); outputs.add(symbol); assignments.put(symbol, symbol.toSymbolReference()); Symbol symbol = right.getFieldMappings().get(field); outputs.add(symbol); assignments.put(symbol, symbol.toSymbolReference());
if (coalesceSymbols.containsKey(symbol)) { Expression expression = new CoalesceExpression(symbol.toSymbolReference(), new Cast(new LongLiteral("0"), "bigint")); outputSymbols.put(coalesceSymbols.get(symbol), expression); outputSymbols.putIdentity(symbol); return new ProjectNode(idAllocator.getNextId(), aggregationNode, outputSymbols.build());
leftProjections.putAll(node.getLeft() .getOutputSymbols().stream() .collect(Collectors.toMap(key -> key, Symbol::toSymbolReference))); rightProjections.putAll(node.getRight() .getOutputSymbols().stream() .collect(Collectors.toMap(key -> key, Symbol::toSymbolReference))); leftProjections.put(leftSymbol, leftExpression); rightProjections.put(rightSymbol, rightExpression); !filtersEquivalent || !ImmutableSet.copyOf(equiJoinClauses).equals(ImmutableSet.copyOf(node.getCriteria()))) { leftSource = new ProjectNode(idAllocator.getNextId(), leftSource, leftProjections.build()); rightSource = new ProjectNode(idAllocator.getNextId(), rightSource, rightProjections.build());
leftProjections.putAll(node.getLeft() .getOutputSymbols().stream() .collect(Collectors.toMap(key -> key, Symbol::toSymbolReference))); rightProjections.putAll(node.getRight() .getOutputSymbols().stream() .collect(Collectors.toMap(key -> key, Symbol::toSymbolReference))); leftSource = new ProjectNode(idAllocator.getNextId(), leftSource, leftProjections.build()); rightSource = new ProjectNode(idAllocator.getNextId(), rightSource, rightProjections.build());
.forEach(nameReference -> { Symbol symbol = Symbol.from(nameReference); projections.put(symbol, nameReference); inputs.add(symbol); }); projections.put(exchange.getPartitioningScheme().getHashColumn().get(), exchange.getPartitioningScheme().getHashColumn().get().toSymbolReference()); inputs.add(exchange.getPartitioningScheme().getHashColumn().get()); .forEach(nameReference -> { Symbol symbol = Symbol.from(nameReference); projections.put(symbol, nameReference); inputs.add(symbol); }); Type type = context.getSymbolAllocator().getTypes().get(projection.getKey()); Symbol symbol = context.getSymbolAllocator().newSymbol(translatedExpression, type); projections.put(symbol, translatedExpression); inputs.add(symbol); newSourceBuilder.add(new ProjectNode(context.getIdAllocator().getNextId(), exchange.getSources().get(i), projections.build())); inputsBuilder.add(inputs.build());
decorrelatedBuildSource, Assignments.builder() .putIdentities(decorrelatedBuildSource.getOutputSymbols()) .put(buildSideKnownNonNull, bigint(0)) .build()); aggregation, Assignments.builder() .putIdentities(apply.getInput().getOutputSymbols()) .put(inPredicateOutputSymbol, inPredicateEquivalent) .build());
if (index < 0) { Expression cast = new Cast(new NullLiteral(), column.getType().getTypeSignature().toString()); assignments.put(output, cast); assignments.put(output, input.toSymbolReference()); assignments.put(output, cast); ProjectNode projectNode = new ProjectNode(idAllocator.getNextId(), plan.getRoot(), assignments.build());
.putIdentities(aggregationOutputSymbols) .putAll(subqueryProjection.get().getAssignments()) .build();
Symbol symbol = context.getSymbolAllocator().newSymbol(filter, BOOLEAN); verify(!mask.isPresent(), "Expected aggregation without mask symbols, see Rule pattern"); newAssignments.put(symbol, filter); mask = Optional.of(symbol); newAssignments.putIdentities(aggregation.getSource().getOutputSymbols()); context.getIdAllocator().getNextId(), aggregation.getSource(), newAssignments.build()), predicate), aggregations.build(),
.putAll(assignmentsWithoutTargetOutputIdentities) .putIdentities(targetInputs) .build();
node.getSource(), Assignments.builder() .putIdentities(node.getSource().getOutputSymbols()) .put(partitionCountSymbol, new LongLiteral(Integer.toString(getHashPartitionCount(context.getSession())))) .putAll(envelopeAssignments.build()) .build()), aggregations.build(), node.getGroupingSets(),
symbol.toSymbolReference(), symbolAllocator.getTypes().get(symbol)); outputSymbols.put(newSymbol, expression); symbol.toSymbolReference(), symbolAllocator.getTypes().get(symbol)); outputSymbols.put(newSymbol, expression); outputSymbols.put(symbol, expression); outputSymbols.put(aggregateInfo.getMask(), new NullLiteral()); return new ProjectNode(idAllocator.getNextId(), source, outputSymbols.build());
p.project( Assignments.builder() .put(p.symbol("one"), expression("CAST(1 AS bigint)")) .putIdentities(ImmutableList.of(p.symbol("a"), p.symbol("avgOutput"))) .build(), p.project( Assignments.identity(p.symbol("a"), p.symbol("avgOutput"), p.symbol("unused")),
return p.project( Assignments.builder() .put(aTimes5, new ArithmeticBinaryExpression(ArithmeticBinaryExpression.Operator.MULTIPLY, new SymbolReference("a"), new LongLiteral("5"))) .put(bTimes5, new ArithmeticBinaryExpression(ArithmeticBinaryExpression.Operator.MULTIPLY, new SymbolReference("b"), new LongLiteral("5"))) .put(hTimes5, new ArithmeticBinaryExpression(ArithmeticBinaryExpression.Operator.MULTIPLY, new SymbolReference("h"), new LongLiteral("5"))) .build(), p.exchange(e -> e .addSource(
for (Map.Entry<Symbol, Expression> assignment : child.getAssignments().entrySet()) { if (!targets.contains(assignment.getKey())) { childAssignments.put(assignment); childAssignments.putIdentity(input); child.getId(), child.getSource(), childAssignments.build()), Assignments.copyOf(parentAssignments)));
JoinNode.Type.LEFT, p.project(Assignments.builder() .putIdentity(p.symbol("COL1", BIGINT)) .build(), p.aggregation(builder -> builder.singleGroupingSet(p.symbol("COL1"), p.symbol("unused"))
for (Symbol symbol : outerJoin.getOutputSymbols()) { if (aggregationNode.getAggregations().containsKey(symbol)) { assignmentsBuilder.put(symbol, new CoalesceExpression(symbol.toSymbolReference(), sourceAggregationToOverNullMapping.get(symbol).toSymbolReference())); assignmentsBuilder.put(symbol, symbol.toSymbolReference()); return Optional.of(new ProjectNode(idAllocator.getNextId(), crossJoin, assignmentsBuilder.build()));
return p.project( Assignments.builder() .put(aTimes5, new ArithmeticBinaryExpression(ArithmeticBinaryExpression.Operator.MULTIPLY, new SymbolReference("a"), new LongLiteral("5"))) .put(bTimes5, new ArithmeticBinaryExpression(ArithmeticBinaryExpression.Operator.MULTIPLY, new SymbolReference("b"), new LongLiteral("5"))) .put(hTimes5, new ArithmeticBinaryExpression(ArithmeticBinaryExpression.Operator.MULTIPLY, new SymbolReference("h"), new LongLiteral("5"))) .build(), p.exchange(e -> e .addSource(