use of com.facebook.presto.sql.tree.SymbolReference in project presto by prestodb.
the class FunctionAssertions method needsBoundValue.
private static boolean needsBoundValue(Expression projectionExpression) {
final AtomicBoolean hasSymbolReferences = new AtomicBoolean();
new DefaultTraversalVisitor<Void, Void>() {
@Override
protected Void visitSymbolReference(SymbolReference node, Void context) {
hasSymbolReferences.set(true);
return null;
}
}.process(projectionExpression, null);
return hasSymbolReferences.get();
}
use of com.facebook.presto.sql.tree.SymbolReference in project presto by prestodb.
the class ProjectNode method isIdentity.
public boolean isIdentity() {
for (Map.Entry<Symbol, Expression> entry : assignments.entrySet()) {
Expression expression = entry.getValue();
Symbol symbol = entry.getKey();
if (!(expression instanceof SymbolReference && ((SymbolReference) expression).getName().equals(symbol.getName()))) {
return false;
}
}
return true;
}
use of com.facebook.presto.sql.tree.SymbolReference in project presto by prestodb.
the class SimplifyCountOverConstant method isCountOverConstant.
private static boolean isCountOverConstant(AggregationNode.Aggregation aggregation, Assignments inputs) {
Signature signature = aggregation.getSignature();
if (!signature.getName().equals("count") || signature.getArgumentTypes().size() != 1) {
return false;
}
Expression argument = aggregation.getCall().getArguments().get(0);
if (argument instanceof SymbolReference) {
argument = inputs.get(Symbol.from(argument));
}
return argument instanceof Literal && !(argument instanceof NullLiteral);
}
Aggregations