[ https://issues.apache.org/jira/browse/HIVE-25861?focusedWorklogId=707572&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-707572 ]
ASF GitHub Bot logged work on HIVE-25861: ----------------------------------------- Author: ASF GitHub Bot Created on: 12/Jan/22 15:25 Start Date: 12/Jan/22 15:25 Worklog Time Spent: 10m Work Description: asolimando commented on pull request #2942: URL: https://github.com/apache/hive/pull/2942#issuecomment-1011158874 Can you add a ptest based on the query you provided in the JIRA case or, possibly, a simpler version of it? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking ------------------- Worklog Id: (was: 707572) Remaining Estimate: 0h Time Spent: 10m > When ConstantPropagate optimizer optimizes case when equals case when twice, > got wrong logical execution plan > ------------------------------------------------------------------------------------------------------------- > > Key: HIVE-25861 > URL: https://issues.apache.org/jira/browse/HIVE-25861 > Project: Hive > Issue Type: Bug > Components: Logical Optimizer > Reporter: Jun Di > Assignee: Jun Di > Priority: Critical > Attachments: 1.png, 2.png > > Time Spent: 10m > Remaining Estimate: 0h > > when run the following sql: > {code:sql} > select > t1.column_1, > t2.column_1, > t1.column_2, > t1.column_3, > case > when ( > case > when t1.column_1 in (310000, 320000, 330000, 340000) > then 310000 > else t1.column_1 > end > ) = ( > case > when t2.column_1 in (310000, 320000, 330000, 340000) > then 310000 > else t2.column_1 > end > ) > then t1.column_2 > else t1.column_3 > end as result > from > dim.dim_xmf_center t1 > left join dim.dim_xmf_center t2 > where > t1.mt = '202201'; > {code} > t1.column_1 is 440000 and t2.column_1 is 440000 but the result is t1.column_3 > Please see picture 1.png in the attachment for the result > I found that the case when part of the execution plan is wrong: > {code:sql} > CASE WHEN (CASE WHEN ((_col20) IN (310000, 320000, 330000, 340000)) THEN > (CASE WHEN ((_col46) IN (310000, 320000, 330000, 340000)) THEN ((true = > _col20)) ELSE (((_col46 = 310000) = _col20)) END) ELSE (CASE WHEN ((_col46) > IN (310000, 320000, 330000, 340000)) THEN ((true = _col20)) ELSE (((_col46 = > 310000) = _col20)) END) END) THEN (_col12) ELSE (_col15) END > {code} -- This message was sent by Atlassian Jira (v8.20.1#820001)