[ https://issues.apache.org/jira/browse/HIVE-14431?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15992822#comment-15992822 ]
Remus Rusanu edited comment on HIVE-14431 at 5/2/17 12:48 PM: -------------------------------------------------------------- Not all changes are in RexSimplify. The 3rd case you added {code} + // 3) Another simplification + // CASE + // WHEN p1 THEN x + // WHEN p2 THEN y + // ELSE TRUE + // END {code} is not currently in Calcite. I made the changes in Hive, but the CASE is left as a CASE, not transformed into an OR. was (Author: rusanu): @jcamachorodriguez Not all changes are in RexSimplify. The 3rd case you added {code} + // 3) Another simplification + // CASE + // WHEN p1 THEN x + // WHEN p2 THEN y + // ELSE TRUE + // END {code} is not currently in Calcite. I made the changes in Hive, but the CASE is left as a CASE, not transformed into an OR. > Recognize COALESCE as CASE > -------------------------- > > Key: HIVE-14431 > URL: https://issues.apache.org/jira/browse/HIVE-14431 > Project: Hive > Issue Type: Improvement > Components: CBO > Affects Versions: 2.2.0 > Reporter: Jesus Camacho Rodriguez > Assignee: Remus Rusanu > Attachments: HIVE-14431.01.patch, HIVE-14431.03.patch, > HIVE-14431.2.patch, HIVE-14431.patch > > > Transform: > {code} > (COALESCE(a, '') = '') OR > (a = 'A' AND b = c) OR > (a = 'B' AND b = d) OR > (a = 'C' AND b = e) OR > (a = 'D' AND b = f) OR > (a = 'E' AND b = g) OR > (a = 'F' AND b = h) > {code} > into: > {code} > (a='') OR > (a is null) OR > (a = 'A' AND b = c) OR > (a = 'B' AND b = d) OR > (a = 'C' AND b = e) OR > (a = 'D' AND b = f) OR > (a = 'E' AND b = g) OR > (a = 'F' AND b = h) > {code} > With complex queries, this will lead us to factor more predicates that could > be pushed to the TS. -- This message was sent by Atlassian JIRA (v6.3.15#6346)