You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by fh...@apache.org on 2018/02/05 14:58:30 UTC

[3/3] flink git commit: [FLINK-8242] [table] RexProgramExtractor only translates literals of known types.

[FLINK-8242] [table] RexProgramExtractor only translates literals of known types.


Project: http://git-wip-us.apache.org/repos/asf/flink/repo
Commit: http://git-wip-us.apache.org/repos/asf/flink/commit/624131be
Tree: http://git-wip-us.apache.org/repos/asf/flink/tree/624131be
Diff: http://git-wip-us.apache.org/repos/asf/flink/diff/624131be

Branch: refs/heads/release-1.4
Commit: 624131be3ff2748e0c2be3d6dfc367072e12f72b
Parents: 19fcd5e
Author: Fabian Hueske <fh...@apache.org>
Authored: Tue Jan 23 22:10:00 2018 +0100
Committer: Fabian Hueske <fh...@apache.org>
Committed: Mon Feb 5 14:18:16 2018 +0100

----------------------------------------------------------------------
 .../flink/table/plan/util/RexProgramExtractor.scala    | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flink/blob/624131be/flink-libraries/flink-table/src/main/scala/org/apache/flink/table/plan/util/RexProgramExtractor.scala
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-table/src/main/scala/org/apache/flink/table/plan/util/RexProgramExtractor.scala b/flink-libraries/flink-table/src/main/scala/org/apache/flink/table/plan/util/RexProgramExtractor.scala
index a377a95..5366e5b 100644
--- a/flink-libraries/flink-table/src/main/scala/org/apache/flink/table/plan/util/RexProgramExtractor.scala
+++ b/flink-libraries/flink-table/src/main/scala/org/apache/flink/table/plan/util/RexProgramExtractor.scala
@@ -29,9 +29,10 @@ import org.apache.flink.table.calcite.FlinkTypeFactory
 import org.apache.flink.table.expressions.{And, Expression, Literal, Or, ResolvedFieldReference}
 import org.apache.flink.table.validate.FunctionCatalog
 import org.apache.flink.util.Preconditions
-
 import java.sql.{Date, Time, Timestamp}
 
+import org.slf4j.{Logger, LoggerFactory}
+
 import scala.collection.JavaConversions._
 import scala.collection.JavaConverters._
 import scala.collection.mutable
@@ -39,6 +40,8 @@ import scala.util.{Failure, Success, Try}
 
 object RexProgramExtractor {
 
+  lazy val LOG: Logger = LoggerFactory.getLogger(getClass)
+
   /**
     * Extracts the indices of input fields which accessed by the RexProgram.
     *
@@ -214,7 +217,13 @@ class RexNodeToExpressionConverter(
         // convert to BigDecimal
         literal.getValueAs(classOf[java.math.BigDecimal])
 
-      case _ => literal.getValue
+      case _ =>
+        // Literal type is not supported.
+        RexProgramExtractor.LOG.debug(
+          "Literal {} of SQL type {} is not supported and cannot be converted. " +
+            "Please reach out to the community if you think this type should be supported.",
+          Array(literal, literal.getType): _*)
+        return None
     }
 
     Some(Literal(literalValue, literalType))