public static Signature comparisonExpressionSignature(ComparisonExpression.Operator operator, Type leftType, Type rightType) { for (OperatorType operatorType : OperatorType.values()) { if (operatorType.name().equals(operator.name())) { return internalOperator(operator.name(), parseTypeSignature(StandardTypes.BOOLEAN), leftType.getTypeSignature(), rightType.getTypeSignature()); } } return internalScalarFunction(operator.name(), parseTypeSignature(StandardTypes.BOOLEAN), leftType.getTypeSignature(), rightType.getTypeSignature()); }
public static Signature comparisonExpressionSignature(ComparisonExpression.Operator operator, Type leftType, Type rightType) { for (OperatorType operatorType : OperatorType.values()) { if (operatorType.name().equals(operator.name())) { return internalOperator(operator.name(), parseTypeSignature(StandardTypes.BOOLEAN), leftType.getTypeSignature(), rightType.getTypeSignature()); } } return internalScalarFunction(operator.name(), parseTypeSignature(StandardTypes.BOOLEAN), leftType.getTypeSignature(), rightType.getTypeSignature()); }
@Override protected Object visitComparisonExpression(ComparisonExpression node, Object context) { ComparisonExpression.Operator operator = node.getOperator(); Object left = process(node.getLeft(), context); if (left == null && operator != ComparisonExpression.Operator.IS_DISTINCT_FROM) { return null; } Object right = process(node.getRight(), context); if (operator == ComparisonExpression.Operator.IS_DISTINCT_FROM) { if (left == null && right == null) { return false; } else if (left == null || right == null) { return true; } } else if (right == null) { return null; } if (hasUnresolvedValue(left, right)) { return new ComparisonExpression(operator, toExpression(left, type(node.getLeft())), toExpression(right, type(node.getRight()))); } return invokeOperator(OperatorType.valueOf(operator.name()), types(node.getLeft(), node.getRight()), ImmutableList.of(left, right)); }
@Override protected Object visitComparisonExpression(ComparisonExpression node, Object context) { ComparisonExpression.Operator operator = node.getOperator(); Object left = process(node.getLeft(), context); if (left == null && operator != ComparisonExpression.Operator.IS_DISTINCT_FROM) { return null; } Object right = process(node.getRight(), context); if (operator == ComparisonExpression.Operator.IS_DISTINCT_FROM) { if (left == null && right == null) { return false; } else if (left == null || right == null) { return true; } } else if (right == null) { return null; } if (hasUnresolvedValue(left, right)) { return new ComparisonExpression(operator, toExpression(left, type(node.getLeft())), toExpression(right, type(node.getRight()))); } return invokeOperator(OperatorType.valueOf(operator.name()), types(node.getLeft(), node.getRight()), ImmutableList.of(left, right)); }
@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()); }