[ 
https://issues.apache.org/jira/browse/FLINK-23761?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

zhengjiewen updated FLINK-23761:
--------------------------------
    Attachment: image-2021-08-13-16-09-19-951.png

> FlinkSQL1.12 BatchMode Group By with INT type can not produce the correct 
> result
> --------------------------------------------------------------------------------
>
>                 Key: FLINK-23761
>                 URL: https://issues.apache.org/jira/browse/FLINK-23761
>             Project: Flink
>          Issue Type: Bug
>          Components: Table SQL / Planner
>    Affects Versions: 1.12.2
>            Reporter: zhengjiewen
>            Priority: Major
>         Attachments: image-2021-08-13-16-08-31-970.png, 
> image-2021-08-13-16-09-19-951.png
>
>
> When Run a Flink Sql which have Group By oprator, and filed type is INT 
> type,the result is incorrect.
> I try to CAST the field to BIGINT type OR STRING type, the result is correct.
> the SQL is folllow: 【receipt_year ,receipt_month {color:#172b4d}is INT 
> type{color} 】
> {code:java}
>  "     SELECT " +
>                 "        ware_id, " +
>                 "        supplier_id," +
>                 "        supplier_name," +
>                 "        receipt_year as years, " +
>                 "        receipt_month  as months, " +
>                 "        SUM(COALESCE(receipt_count,0) * COALESCE(price,0.0)) 
> / SUM(COALESCE(receipt_count,0)) as supply_avg_price" +
>                 "     FROM " +
>                 "        
> `kudu`.`default_database`.`impala::cube_kudu.dwd_storage_purchase_receipt` " +
>                 "     WHERE " +
>                 "        receipt_date BETWEEN TO_TIMESTAMP('"+ beginTime +"') 
> AND TO_TIMESTAMP('"+ endTime +"') " +
>                 "     GROUP BY " +
>                 "        ware_id, supplier_id, supplier_name, receipt_year , 
> receipt_month "
> {code}
> {color:#172b4d}Here is the execution plan:{color}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to