Github user fhueske commented on a diff in the pull request:
https://github.com/apache/flink/pull/1958#discussion_r62681558
--- Diff:
flink-libraries/flink-table/src/main/scala/org/apache/flink/api/table/expressions/arithmetic.scala
---
@@ -25,15 +25,29 @@ import org.apache.calcite.sql.SqlOperator
import org.apache.calcite.sql.fun.SqlStdOperatorTable
import org.apache.calcite.tools.RelBuilder
-import org.apache.flink.api.common.typeinfo.BasicTypeInfo
-import org.apache.flink.api.table.typeutils.TypeConverter
+import org.apache.flink.api.common.typeinfo.{BasicTypeInfo,
NumericTypeInfo, TypeInformation}
+import org.apache.flink.api.table.typeutils.{TypeCheckUtils, TypeConverter}
+import org.apache.flink.api.table.validate.ExprValidationResult
-abstract class BinaryArithmetic extends BinaryExpression { self: Product =>
+abstract class BinaryArithmetic extends BinaryExpression {
def sqlOperator: SqlOperator
override def toRexNode(implicit relBuilder: RelBuilder): RexNode = {
relBuilder.call(sqlOperator, children.map(_.toRexNode))
}
+
+ override def dataType = left.dataType
+
+ // TODO: tighten this rule once we implemented type coercion rules
during validation
+ override def validateInput(): ExprValidationResult = {
+ if (!left.dataType.isInstanceOf[NumericTypeInfo[_]] ||
+ !right.dataType.isInstanceOf[NumericTypeInfo[_]]) {
+ ExprValidationResult.ValidationFailure(s"$this require both operand
Numeric, get" +
--- End diff --
Please change to `"$this requireS both operandS to be Numeric"
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---