[ https://issues.apache.org/jira/browse/FLINK-20747?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17254424#comment-17254424 ]
zengjinbo commented on FLINK-20747: ----------------------------------- The problem is: {code:java} case when max(t2.multi_type) in ('单品','NBA') and t2.store_brd in ('AD','AS','AO','AK','RB') and (sum(t1.sal_qty) <= 5 or sum(t1.sal_amt) <= 3000) then 1 when max(t2.multi_type) in ('单品','NBA') and t2.store_brd in ('AD','AS','AO','AK','RB') and (sum(t1.sal_qty) > 5 and sum(t1.sal_amt) > 3000) then 0 when max(t2.multi_type) in ('单品','NBA') and t2.store_brd in ('NK') then 1 when max(t2.multi_type) in ('单品','NBA') and t2.store_brd not in ('NK','AD','AS','AO','AK','RB') and sum(t1.sal_qty) < 10 then 1 when max(t2.multi_type) in ('单品','NBA') and t2.store_brd not in ('NK','AD','AS','AO','AK','RB') and sum(t1.sal_qty) >= 10 then 0 when max(t2.multi_type)='多品' and sum(t1.sal_qty) < 15 then 1 else 0 end upt_flag, max(case t1.is_online when 1 then 0 else case t1.sys_source when 6 then 0 else case t1.virtual_flag when 0 then 0 else 1 end end end ) cr_flag, 1 as nos_num_flag{code} > ClassCastException when using MAX aggregate function > ---------------------------------------------------- > > Key: FLINK-20747 > URL: https://issues.apache.org/jira/browse/FLINK-20747 > Project: Flink > Issue Type: Bug > Components: Table SQL / Planner > Affects Versions: 1.12.0 > Reporter: zengjinbo > Priority: Critical > Fix For: 1.12.0, 1.13.0 > > Attachments: image-2020-12-23-18-04-21-079.png > > > During the process of upgrading 1.12.0, I found that Flink SQL is not > compatible with 1.11.1 > java.lang.ClassCastException: java.lang.Integer cannot be cast to > org.apache.flink.table.data.StringDatajava.lang.ClassCastException: > java.lang.Integer cannot be cast to org.apache.flink.table.data.StringData at > org$apache$flink$table$planner$functions$aggfunctions$MaxWithRetractAggFunction$MaxWithRetractAccumulator$Converter.toInternal(Unknown > Source) at > org.apache.flink.table.data.conversion.StructuredObjectConverter.toInternal(StructuredObjectConverter.java:92) > at > org.apache.flink.table.data.conversion.StructuredObjectConverter.toInternal(StructuredObjectConverter.java:47) > at > org.apache.flink.table.data.conversion.DataStructureConverter.toInternalOrNull(DataStructureConverter.java:59) > at GroupAggsHandler$875.getAccumulators(Unknown Source) at > org.apache.flink.table.runtime.operators.aggregate.GroupAggFunction.processElement(GroupAggFunction.java:175) > at > org.apache.flink.table.runtime.operators.aggregate.GroupAggFunction.processElement(GroupAggFunction.java:45) > at > org.apache.flink.streaming.api.operators.KeyedProcessOperator.processElement(KeyedProcessOperator.java:85) > at > org.apache.flink.streaming.runtime.tasks.OneInputStreamTask$StreamTaskNetworkOutput.emitRecord(OneInputStreamTask.java:193) > at > org.apache.flink.streaming.runtime.io.StreamTaskNetworkInput.processElement(StreamTaskNetworkInput.java:179) > at > org.apache.flink.streaming.runtime.io.StreamTaskNetworkInput.emitNext(StreamTaskNetworkInput.java:152) > at > org.apache.flink.streaming.runtime.io.StreamOneInputProcessor.processInput(StreamOneInputProcessor.java:67) > at > org.apache.flink.streaming.runtime.tasks.StreamTask.processInput(StreamTask.java:372) > at > org.apache.flink.streaming.runtime.tasks.mailbox.MailboxProcessor.runMailboxLoop(MailboxProcessor.java:186) > at > org.apache.flink.streaming.runtime.tasks.StreamTask.runMailboxLoop(StreamTask.java:575) > at > org.apache.flink.streaming.runtime.tasks.StreamTask.invoke(StreamTask.java:539) > at org.apache.flink.runtime.taskmanager.Task.doRun(Task.java:722) at > org.apache.flink.runtime.taskmanager.Task.run(Task.java:547) > > > !image-2020-12-23-18-04-21-079.png! -- This message was sent by Atlassian Jira (v8.3.4#803005)