Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Won't Fix
-
1.6.0
-
None
Description
"insert into mtmp_sink SELECT DATE_FORMAT(time_str2tms,'%Y%d%m') FROM mtmp_source";
We have recently used the date_format method like the above sql, but found that this method does not work.
error msg is :
org.apache.flink.table.codegen.CodeGenException: Incompatible types of expression and result type. Expression[GeneratedExpression(result$6,isNull$7,
java.lang.String result$4 = "%Y, %d %M";
boolean isNull$7 = isNull$3 || false;
java.lang.String result$6 = "";
if (!isNull$7)
,String,false)] type is [String], result type is [Timestamp]
at org.apache.flink.table.codegen.CodeGenerator$$anonfun$generateResultExpression$2.apply(CodeGenerator.scala:380)
at org.apache.flink.table.codegen.CodeGenerator$$anonfun$generateResultExpression$2.apply(CodeGenerator.scala:378)
at scala.collection.mutable.ResizableArray$class.foreach(ResizableArray.scala:59)
at scala.collection.mutable.ArrayBuffer.foreach(ArrayBuffer.scala:48)
at org.apache.flink.table.codegen.CodeGenerator.generateResultExpression(CodeGenerator.scala:378)
at org.apache.flink.table.codegen.CodeGenerator.generateResultExpression(CodeGenerator.scala:336)
at org.apache.flink.table.plan.nodes.CommonCalc$class.generateFunction(CommonCalc.scala:45)
at org.apache.flink.table.plan.nodes.datastream.DataStreamCalc.generateFunction(DataStreamCalc.scala:43)
at org.apache.flink.table.plan.nodes.datastream.DataStreamCalc.translateToPlan(DataStreamCalc.scala:116)
at org.apache.flink.table.plan.nodes.datastream.DataStreamGroupAggregate.translateToPlan(DataStreamGroupAggregate.scala:113)
at org.apache.flink.table.plan.nodes.datastream.DataStreamCalc.translateToPlan(DataStreamCalc.scala:97)
at org.apache.flink.table.api.StreamTableEnvironment.translateToCRow(StreamTableEnvironment.scala:999)
at org.apache.flink.table.api.StreamTableEnvironment.translate(StreamTableEnvironment.scala:926)
at org.apache.flink.table.api.StreamTableEnvironment.writeToSink(StreamTableEnvironment.scala:372)
at org.apache.flink.table.api.TableEnvironment.insertInto(TableEnvironment.scala:786)
at org.apache.flink.table.api.TableEnvironment.sqlUpdate(TableEnvironment.scala:723)
at org.apache.flink.table.api.TableEnvironment.sqlUpdate(TableEnvironment.scala:683)
Attachments
Attachments
Issue Links
- is related to
-
FLINK-10032 Rework SQL DATE_FORMAT function
- Resolved