You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "John Fang (JIRA)" <ji...@apache.org> on 2017/10/13 05:20:00 UTC

[jira] [Created] (FLINK-7833) Flink's Literal(value, SqlTimeTypeInfo) fails to convert Calctie's RexNode

John Fang created FLINK-7833:
--------------------------------

             Summary: Flink's Literal(value, SqlTimeTypeInfo) fails to convert Calctie's RexNode
                 Key: FLINK-7833
                 URL: https://issues.apache.org/jira/browse/FLINK-7833
             Project: Flink
          Issue Type: Bug
          Components: Table API & SQL
            Reporter: John Fang
             Fix For: 1.4.0


```
Caused by: java.lang.ClassCastException: java.util.GregorianCalendar cannot be cast to java.util.Date
  at org.apache.flink.table.expressions.Literal.dateToCalendar(literals.scala:116)
  at org.apache.flink.table.expressions.Literal.toRexNode(literals.scala:84)
  at org.apache.flink.table.expressions.BinaryComparison$$anonfun$toRexNode$1.apply(comparison.scala:35)
  at org.apache.flink.table.expressions.BinaryComparison$$anonfun$toRexNode$1.apply(comparison.scala:35)
  at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:234)
  at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:234)
  at scala.collection.immutable.List.foreach(List.scala:392)
  at scala.collection.TraversableLike$class.map(TraversableLike.scala:234)
  at scala.collection.immutable.List.map(List.scala:296)
  at org.apache.flink.table.expressions.BinaryComparison.toRexNode(comparison.scala:35)
  at org.apache.flink.table.plan.rules.logical.PushFilterIntoTableSourceScanRule$$anonfun$1.apply(PushFilterIntoTableSourceScanRule.scala:97)
  at org.apache.flink.table.plan.rules.logical.PushFilterIntoTableSourceScanRule$$anonfun$1.apply(PushFilterIntoTableSourceScanRule.scala:97)
  at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:234)
  at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:234)
  at scala.collection.Iterator$class.foreach(Iterator.scala:891)
  at scala.collection.AbstractIterator.foreach(Iterator.scala:1334)
  at scala.collection.IterableLike$class.foreach(IterableLike.scala:72)
  at scala.collection.AbstractIterable.foreach(Iterable.scala:54)
  at scala.collection.TraversableLike$class.map(TraversableLike.scala:234)
  at scala.collection.AbstractTraversable.map(Traversable.scala:104)
  at org.apache.flink.table.plan.rules.logical.PushFilterIntoTableSourceScanRule.pushFilterIntoScan(PushFilterIntoTableSourceScanRule.scala:97)
  at org.apache.flink.table.plan.rules.logical.PushFilterIntoTableSourceScanRule.onMatch(PushFilterIntoTableSourceScanRule.scala:60)
  at org.apache.calcite.plan.volcano.VolcanoRuleCall.onMatch(VolcanoRuleCall.java:212)
```
Using the `RexProgramExtractor.visitLiteral` will invoke Calcite's `RexLiteral.getValue` to generator `Literal(value, type)`. If the type is TIME|DATE|TIMESTAMP, then Calcite's  return type of `RexLiteral.getValue'` is `Calendar`. After that, the `Literal(value, type)` maybe convert `RexNode` by invoking `Literal.toRexNode`. Then it will invoked the function `dateToCalendar`. Thus it will cause the exception.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)