Benoît Paris created FLINK-15867:
------------------------------------ Summary: LAST_VALUE aggregate function does not support time-related types Key: FLINK-15867 URL: https://issues.apache.org/jira/browse/FLINK-15867 Project: Flink Issue Type: Bug Components: Table SQL / Planner Affects Versions: 1.9.2, 1.10.0 Reporter: Benoît Paris Attachments: flink-test-lastvalue-timestamp.zip The following fails: {code:java} LAST_VALUE(TIMESTAMP '2020-02-03 16:17:20') LAST_VALUE(DATE '2020-02-03') LAST_VALUE(TIME '16:17:20') LAST_VALUE(NOW()){code} But this works: {code:java} LAST_VALUE(UNIX_TIMESTAMP()) {code} Leading me to say it might be more a type/format issue, rather than an actual time processing issue. Attached is java + pom + full stacktrace, for reproduction. Stacktrace part is below. The ByteLastValueAggFunction, etc types seem trivial to implement, but the in the createLastValueAggFunction only basic types seem to be dealt with. Is there a reason more complicated LogicalTypeRoots might not be implemented ? (old vs new types?) Caused by: org.apache.flink.table.api.TableException: LAST_VALUE aggregate function does not support type: ''TIMESTAMP_WITHOUT_TIME_ZONE''.Caused by: org.apache.flink.table.api.TableException: LAST_VALUE aggregate function does not support type: ''TIMESTAMP_WITHOUT_TIME_ZONE''.Please re-check the data type. at org.apache.flink.table.planner.plan.utils.AggFunctionFactory.createLastValueAggFunction(AggFunctionFactory.scala:617) at org.apache.flink.table.planner.plan.utils.AggFunctionFactory.createAggFunction(AggFunctionFactory.scala:113) at org.apache.flink.table.planner.plan.utils.AggregateUtil$$anonfun$9.apply(AggregateUtil.scala:285) at org.apache.flink.table.planner.plan.utils.AggregateUtil$$anonfun$9.apply(AggregateUtil.scala:279) 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.mutable.ResizableArray$class.foreach(ResizableArray.scala:59) at scala.collection.mutable.ArrayBuffer.foreach(ArrayBuffer.scala:48) at scala.collection.TraversableLike$class.map(TraversableLike.scala:234) at scala.collection.AbstractTraversable.map(Traversable.scala:104) at org.apache.flink.table.planner.plan.utils.AggregateUtil$.transformToAggregateInfoList(AggregateUtil.scala:279) at org.apache.flink.table.planner.plan.utils.AggregateUtil$.transformToStreamAggregateInfoList(AggregateUtil.scala:228) at org.apache.flink.table.planner.plan.nodes.physical.stream.StreamExecGroupAggregate.<init>(StreamExecGroupAggregate.scala:72) at org.apache.flink.table.planner.plan.rules.physical.stream.StreamExecGroupAggregateRule.convert(StreamExecGroupAggregateRule.scala:68) at org.apache.calcite.rel.convert.ConverterRule.onMatch(ConverterRule.java:139) at org.apache.calcite.plan.volcano.VolcanoRuleCall.onMatch(VolcanoRuleCall.java:208) at org.apache.calcite.plan.volcano.VolcanoPlanner.findBestExp(VolcanoPlanner.java:631) at org.apache.calcite.tools.Programs$RuleSetProgram.run(Programs.java:328) at org.apache.flink.table.planner.plan.optimize.program.FlinkVolcanoProgram.optimize(FlinkVolcanoProgram.scala:64) ---- -- This message was sent by Atlassian Jira (v8.3.4#803005) |
Free forum by Nabble | Edit this page |