[ 
https://issues.apache.org/jira/browse/FLINK-10143?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16719879#comment-16719879
 ] 

vinoyang commented on FLINK-10143:
----------------------------------

Hi [~twalthr]  We also encountered this problem and then found this issue. I 
want to know if we can improve its priority. Or temporarily remove this 
function from the official documentation or give a description of the problem. 
Otherwise it will cause trouble to the user.

> date_format throws CodeGenException
> -----------------------------------
>
>                 Key: FLINK-10143
>                 URL: https://issues.apache.org/jira/browse/FLINK-10143
>             Project: Flink
>          Issue Type: Bug
>          Components: Table API & SQL
>    Affects Versions: 1.6.0
>            Reporter: sean.miao
>            Priority: Major
>         Attachments: image-2018-08-14-18-11-40-144.png
>
>
> "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.
> !image-2018-08-14-18-11-40-144.png!
> 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) {
>  
>  result$6 = dateFormatter$5.print(result$2);
>  
> isNull$7 = (result$6 == null);
>  
> }
> ,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)



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to