public static List<Expression> extractPredicates(LogicalBinaryExpression.Operator operator, Expression expression) { if (expression instanceof LogicalBinaryExpression && ((LogicalBinaryExpression) expression).getOperator() == operator) { LogicalBinaryExpression logicalBinaryExpression = (LogicalBinaryExpression) expression; return ImmutableList.<Expression>builder() .addAll(extractPredicates(operator, logicalBinaryExpression.getLeft())) .addAll(extractPredicates(operator, logicalBinaryExpression.getRight())) .build(); } return ImmutableList.of(expression); }
public static List<Expression> extractPredicates(LogicalBinaryExpression.Operator operator, Expression expression) { if (expression instanceof LogicalBinaryExpression && ((LogicalBinaryExpression) expression).getOperator() == operator) { LogicalBinaryExpression logicalBinaryExpression = (LogicalBinaryExpression) expression; return ImmutableList.<Expression>builder() .addAll(extractPredicates(operator, logicalBinaryExpression.getLeft())) .addAll(extractPredicates(operator, logicalBinaryExpression.getRight())) .build(); } return ImmutableList.of(expression); }
@Override protected PlanNodeStatsEstimate visitLogicalBinaryExpression(LogicalBinaryExpression node, Void context) { switch (node.getOperator()) { case AND: return estimateLogicalAnd(node.getLeft(), node.getRight()); case OR: return estimateLogicalOr(node.getLeft(), node.getRight()); default: throw new IllegalArgumentException("Unexpected binary operator: " + node.getOperator()); } }
@Override protected PlanNodeStatsEstimate visitLogicalBinaryExpression(LogicalBinaryExpression node, Void context) { switch (node.getOperator()) { case AND: return estimateLogicalAnd(node.getLeft(), node.getRight()); case OR: return estimateLogicalOr(node.getLeft(), node.getRight()); default: throw new IllegalArgumentException("Unexpected binary operator: " + node.getOperator()); } }
@Override protected Boolean visitLogicalBinaryExpression(LogicalBinaryExpression node, Void context) { return process(node.getLeft(), context) && process(node.getRight(), context); }
@Override protected R visitLogicalBinaryExpression(LogicalBinaryExpression node, C context) { process(node.getLeft(), context); process(node.getRight(), context); return null; }
@Override protected Boolean visitLogicalBinaryExpression(LogicalBinaryExpression node, Void context) { return process(node.getLeft(), context) && process(node.getRight(), context); }
@Override protected R visitLogicalBinaryExpression(LogicalBinaryExpression node, C context) { process(node.getLeft(), context); process(node.getRight(), context); return null; }
@Override protected Type visitLogicalBinaryExpression(LogicalBinaryExpression node, StackableAstVisitorContext<Context> context) { coerceType(context, node.getLeft(), BOOLEAN, "Left side of logical expression"); coerceType(context, node.getRight(), BOOLEAN, "Right side of logical expression"); return setExpressionType(node, BOOLEAN); }
@Override protected Type visitLogicalBinaryExpression(LogicalBinaryExpression node, StackableAstVisitorContext<Context> context) { coerceType(context, node.getLeft(), BOOLEAN, "Left side of logical expression"); coerceType(context, node.getRight(), BOOLEAN, "Right side of logical expression"); return setExpressionType(node, BOOLEAN); }
@Override protected String visitLogicalBinaryExpression(LogicalBinaryExpression node, Void context) { return formatBinaryExpression(node.getOperator().toString(), node.getLeft(), node.getRight()); }
@Override protected String visitLogicalBinaryExpression(LogicalBinaryExpression node, Void context) { return formatBinaryExpression(node.getOperator().toString(), node.getLeft(), node.getRight()); }
@Override protected RowExpression visitLogicalBinaryExpression(LogicalBinaryExpression node, Void context) { return call( logicalExpressionSignature(node.getOperator()), BOOLEAN, process(node.getLeft(), context), process(node.getRight(), context)); }
@Override protected RowExpression visitLogicalBinaryExpression(LogicalBinaryExpression node, Void context) { return call( logicalExpressionSignature(node.getOperator()), BOOLEAN, process(node.getLeft(), context), process(node.getRight(), context)); }
@Override protected Boolean visitLogicalBinaryExpression(LogicalBinaryExpression actual, Node expectedExpression) { if (expectedExpression instanceof LogicalBinaryExpression) { LogicalBinaryExpression expected = (LogicalBinaryExpression) expectedExpression; if (actual.getOperator() == expected.getOperator()) { return process(actual.getLeft(), expected.getLeft()) && process(actual.getRight(), expected.getRight()); } } return false; }
@Override protected Boolean visitLogicalBinaryExpression(LogicalBinaryExpression actual, Node expectedExpression) { if (expectedExpression instanceof LogicalBinaryExpression) { LogicalBinaryExpression expected = (LogicalBinaryExpression) expectedExpression; if (actual.getOperator() == expected.getOperator()) { return process(actual.getLeft(), expected.getLeft()) && process(actual.getRight(), expected.getRight()); } } return false; }
@Override protected ExtractionResult visitLogicalBinaryExpression(LogicalBinaryExpression node, Boolean complement) ExtractionResult leftResult = process(node.getLeft(), complement); ExtractionResult rightResult = process(node.getRight(), complement);
@Override protected ExtractionResult visitLogicalBinaryExpression(LogicalBinaryExpression node, Boolean complement) ExtractionResult leftResult = process(node.getLeft(), complement); ExtractionResult rightResult = process(node.getRight(), complement);