use of io.prestosql.sql.tree.ComparisonExpression.Operator.GREATER_THAN_OR_EQUAL in project hetu-core by openlookeng.
the class SetOperationNodeTranslator method makeSetContainmentPlan.
public TranslationResult makeSetContainmentPlan(SetOperationNode node) {
checkArgument(!(node instanceof UnionNode), "Cannot simplify a UnionNode");
List<Symbol> markers = allocateSymbols(node.getSources().size(), MARKER, BOOLEAN);
// identity projection for all the fields in each of the sources plus marker columns
List<PlanNode> withMarkers = appendMarkers(markers, node.getSources(), node);
// add a union over all the rewritten sources. The outputs of the union have the same name as the
// original intersect node
List<Symbol> outputs = node.getOutputSymbols();
UnionNode union = union(withMarkers, ImmutableList.copyOf(concat(outputs, markers)));
// add count aggregations and filter rows where any of the counts is >= 1
List<Symbol> aggregationOutputs = allocateSymbols(markers.size(), "count", BIGINT);
AggregationNode aggregation = computeCounts(union, outputs, markers, aggregationOutputs);
List<Expression> presentExpression = aggregationOutputs.stream().map(symbol -> new ComparisonExpression(GREATER_THAN_OR_EQUAL, toSymbolReference(symbol), GENERIC_LITERAL)).collect(toImmutableList());
return new TranslationResult(aggregation, presentExpression);
}
Aggregations