use of io.confluent.ksql.execution.interpreter.terms.ComparisonTerm.CompareToTerm in project ksql by confluentinc.
the class ComparisonInterpreter method doComparison.
/**
* Does a comparison between the two terms
* @param type The type of the comparison
* @param left Left term
* @param right Right term
* @return The term representing the result of the comparison
*/
public static Term doComparison(final ComparisonExpression.Type type, final Term left, final Term right) {
final ComparisonNullCheckFunction nullCheckFunction = getNullCheckFunction(type);
final Optional<ComparisonFunction> compareTo = doCompareTo(left, right);
if (compareTo.isPresent()) {
return new CompareToTerm(left, right, nullCheckFunction, compareTo.get(), getComparisonCheckFunction(type, left, right));
}
final Optional<EqualsFunction> equals = doEquals(left, right);
if (equals.isPresent()) {
return new EqualsTerm(left, right, nullCheckFunction, equals.get(), getEqualsCheckFunction(type, left, right));
}
throw new KsqlException("Unsupported comparison between " + left.getSqlType() + " and " + right.getSqlType());
}
Aggregations