Github user xccui commented on a diff in the pull request: https://github.com/apache/flink/pull/6027#discussion_r188894442 --- Diff: flink-libraries/flink-table/src/main/scala/org/apache/flink/table/expressions/logic.scala --- @@ -105,3 +105,75 @@ case class If( } } } + +abstract class BetweenProperty( + expr: Expression, + lowerBound: Expression, + upperBound: Expression) extends Expression { + + override private[flink] def resultType: TypeInformation[_] = BasicTypeInfo.BOOLEAN_TYPE_INFO + + override private[flink] def children: Seq[Expression] = Seq(expr, lowerBound, upperBound) + + override private[flink] def validateInput(): ValidationResult = { + (expr.resultType, lowerBound.resultType, upperBound.resultType) match { + case (exprType, lowerType, upperType) + if isNumeric(exprType) && isNumeric(lowerType) && isNumeric(upperType) + => ValidationSuccess + case (exprType, lowerType, upperType) + if isComparable(exprType) && exprType == lowerType && exprType == upperType + => ValidationSuccess + case (exprType, lowerType, upperType) => + ValidationFailure( + s"Between is only supported for numeric types and " + + s"comparable types of same type, got $exprType, $lowerType and $upperType" --- End diff -- Between is only supported for numeric types and identical comparable types, but got $exprType, $lowerType and $upperType.
---