JingsongLi commented on a change in pull request #9152: 
[FLINK-13314][table-planner-blink] Correct resultType of some PlannerExpression 
when operands contains DecimalTypeInfo or BigDecimalTypeInfo in Blink planner
URL: https://github.com/apache/flink/pull/9152#discussion_r304722135
 
 

 ##########
 File path: 
flink-table/flink-table-planner-blink/src/main/scala/org/apache/flink/table/expressions/ReturnTypeInference.scala
 ##########
 @@ -0,0 +1,216 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.flink.table.expressions
+
+import org.apache.flink.api.common.typeinfo.{BasicTypeInfo, TypeInformation}
+import org.apache.flink.table.api.TableException
+import org.apache.flink.table.calcite.{FlinkTypeFactory, FlinkTypeSystem}
+import 
org.apache.flink.table.types.TypeInfoLogicalTypeConverter.{fromLogicalTypeToTypeInfo,
 fromTypeInfoToLogicalType}
+import org.apache.flink.table.types.logical.{DecimalType, LogicalType}
+import org.apache.flink.table.typeutils.{BigDecimalTypeInfo, DecimalTypeInfo, 
TypeCoercion}
+
+import org.apache.calcite.rel.`type`.RelDataType
+import org.apache.calcite.sql.`type`.SqlTypeUtil
+
+import scala.collection.JavaConverters._
+
+object ReturnTypeInference {
+
+  private lazy val typeSystem = new FlinkTypeSystem
+  private lazy val typeFactory = new FlinkTypeFactory(typeSystem)
+
+  /**
+    * Infer resultType of [[Minus]] expression.
+    * The decimal type inference keeps consistent with Calcite
+    * [[org.apache.calcite.sql.type.ReturnTypes]].NULLABLE_SUM
+    *
+    * @param minus minus Expression
+    * @return result type
+    */
+  def infer(minus: Minus): TypeInformation[_] = inferSum(minus)
 
 Review comment:
   Can you modify `infer` to `inferMinus` and etc..
   Because these classes are inherited, this can easily lead to overloading 
problems.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to