use of org.apache.flink.table.planner.expressions.ExpressionBuilder in project flink by apache.
the class RankLikeAggFunctionBase method orderKeyEqualsExpression.
protected Expression orderKeyEqualsExpression() {
Expression[] orderKeyEquals = new Expression[orderKeyTypes.length];
for (int i = 0; i < orderKeyTypes.length; ++i) {
// pseudo code:
// if (lastValue_i is null) {
// if (operand(i) is null) true else false
// } else {
// lastValue_i equalTo orderKey(i)
// }
Expression lasValue = lastValues[i];
orderKeyEquals[i] = ifThenElse(isNull(lasValue), ifThenElse(isNull(operand(i)), literal(true), literal(false)), equalTo(lasValue, operand(i)));
}
Optional<Expression> ret = Arrays.stream(orderKeyEquals).reduce(ExpressionBuilder::and);
return ret.orElseGet(() -> literal(true));
}
Aggregations