private static boolean isEqualComparisonExpression(Expression conjunct) { return conjunct instanceof ComparisonExpression && ((ComparisonExpression) conjunct).getOperator() == ComparisonExpression.Operator.EQUAL; }
private static boolean isEqualComparisonExpression(Expression conjunct) { return conjunct instanceof ComparisonExpression && ((ComparisonExpression) conjunct).getOperator() == ComparisonExpression.Operator.EQUAL; }
private static boolean isJoinEqualityCondition(Expression expression) { return expression instanceof ComparisonExpression && ((ComparisonExpression) expression).getOperator() == EQUAL && ((ComparisonExpression) expression).getLeft() instanceof SymbolReference && ((ComparisonExpression) expression).getRight() instanceof SymbolReference; }
@Override protected Void visitComparisonExpression(ComparisonExpression node, Integer indentLevel) { print(indentLevel, node.getOperator().toString()); super.visitComparisonExpression(node, indentLevel + 1); return null; }
@Override protected Void visitComparisonExpression(ComparisonExpression node, Integer indentLevel) { print(indentLevel, node.getOperator().toString()); super.visitComparisonExpression(node, indentLevel + 1); return null; }
private static boolean isJoinEqualityCondition(Expression expression) { return expression instanceof ComparisonExpression && ((ComparisonExpression) expression).getOperator() == EQUAL && ((ComparisonExpression) expression).getLeft() instanceof SymbolReference && ((ComparisonExpression) expression).getRight() instanceof SymbolReference; }
private static Set<Expression> equalityAsSet(Expression expression) { Preconditions.checkArgument(expression instanceof ComparisonExpression); ComparisonExpression comparisonExpression = (ComparisonExpression) expression; Preconditions.checkArgument(comparisonExpression.getOperator() == EQUAL); return ImmutableSet.of(comparisonExpression.getLeft(), comparisonExpression.getRight()); }
private static Set<Expression> equalityAsSet(Expression expression) { Preconditions.checkArgument(expression instanceof ComparisonExpression); ComparisonExpression comparisonExpression = (ComparisonExpression) expression; Preconditions.checkArgument(comparisonExpression.getOperator() == EQUAL); return ImmutableSet.of(comparisonExpression.getLeft(), comparisonExpression.getRight()); }
@Override protected String visitComparisonExpression(ComparisonExpression node, Void context) { return formatBinaryExpression(node.getOperator().getValue(), node.getLeft(), node.getRight()); }
@Override protected String visitComparisonExpression(ComparisonExpression node, Void context) { return formatBinaryExpression(node.getOperator().getValue(), node.getLeft(), node.getRight()); }
private static boolean isSupportedSpatialComparison(ComparisonExpression expression) { switch (expression.getOperator()) { case LESS_THAN: case LESS_THAN_OR_EQUAL: return isSTDistance(expression.getLeft()); case GREATER_THAN: case GREATER_THAN_OR_EQUAL: return isSTDistance(expression.getRight()); default: return false; } }
private static boolean isSupportedSpatialComparison(ComparisonExpression expression) { switch (expression.getOperator()) { case LESS_THAN: case LESS_THAN_OR_EQUAL: return isSTDistance(expression.getLeft()); case GREATER_THAN: case GREATER_THAN_OR_EQUAL: return isSTDistance(expression.getRight()); default: return false; } }
@Override protected Type visitComparisonExpression(ComparisonExpression node, StackableAstVisitorContext<Context> context) { OperatorType operatorType = OperatorType.valueOf(node.getOperator().name()); return getOperator(context, node, operatorType, node.getLeft(), node.getRight()); }
@Override protected Type visitComparisonExpression(ComparisonExpression node, StackableAstVisitorContext<Context> context) { OperatorType operatorType = OperatorType.valueOf(node.getOperator().name()); return getOperator(context, node, operatorType, node.getLeft(), node.getRight()); }
public static Expression normalize(Expression expression) { if (expression instanceof NotExpression) { NotExpression not = (NotExpression) expression; if (not.getValue() instanceof ComparisonExpression && ((ComparisonExpression) not.getValue()).getOperator() != IS_DISTINCT_FROM) { ComparisonExpression comparison = (ComparisonExpression) not.getValue(); return new ComparisonExpression(comparison.getOperator().negate(), comparison.getLeft(), comparison.getRight()); } if (not.getValue() instanceof NotExpression) { return normalize(((NotExpression) not.getValue()).getValue()); } } return expression; }
public static Expression normalize(Expression expression) { if (expression instanceof NotExpression) { NotExpression not = (NotExpression) expression; if (not.getValue() instanceof ComparisonExpression && ((ComparisonExpression) not.getValue()).getOperator() != IS_DISTINCT_FROM) { ComparisonExpression comparison = (ComparisonExpression) not.getValue(); return new ComparisonExpression(comparison.getOperator().negate(), comparison.getLeft(), comparison.getRight()); } if (not.getValue() instanceof NotExpression) { return normalize(((NotExpression) not.getValue()).getValue()); } } return expression; }
@Override protected Boolean visitComparisonExpression(ComparisonExpression actual, Node expectedExpression) { if (expectedExpression instanceof ComparisonExpression) { ComparisonExpression expected = (ComparisonExpression) expectedExpression; if (actual.getOperator() == expected.getOperator()) { return process(actual.getLeft(), expected.getLeft()) && process(actual.getRight(), expected.getRight()); } } return false; }
@Override protected Boolean visitComparisonExpression(ComparisonExpression actual, Node expectedExpression) { if (expectedExpression instanceof ComparisonExpression) { ComparisonExpression expected = (ComparisonExpression) expectedExpression; if (actual.getOperator() == expected.getOperator()) { return process(actual.getLeft(), expected.getLeft()) && process(actual.getRight(), expected.getRight()); } } return false; }
@Override protected RowExpression visitComparisonExpression(ComparisonExpression node, Void context) { RowExpression left = process(node.getLeft(), context); RowExpression right = process(node.getRight(), context); return call( comparisonExpressionSignature(node.getOperator(), left.getType(), right.getType()), BOOLEAN, left, right); }
@Override protected RowExpression visitComparisonExpression(ComparisonExpression node, Void context) { RowExpression left = process(node.getLeft(), context); RowExpression right = process(node.getRight(), context); return call( comparisonExpressionSignature(node.getOperator(), left.getType(), right.getType()), BOOLEAN, left, right); }