Steve Carlin created HIVE-27777:
-----------------------------------

             Summary: CBO fails on multi insert overwrites with common group 
expression
                 Key: HIVE-27777
                 URL: https://issues.apache.org/jira/browse/HIVE-27777
             Project: Hive
          Issue Type: Bug
          Components: HiveServer2
            Reporter: Steve Carlin


The following statement is failing in CBO:

 
{code:java}
FROM (select key, f1 FROM tbl1 where key=5) a
INSERT OVERWRITE TABLE tbl2 partition(key=5)
select f1 WHERE key > 0 GROUP by f1
INSERT OVERWRITE TABLE tbl2 partition(key=6)
select f1 WHERE key > 0 GROUP by f1;
{code}
The failure happens when there is a filter to a constant value in the FROM 
clause ,the value is referenced in the filter in the INSERT OVERWRITE, and 
there is a common group existing across the insert overwrites.

CBO is pulling up the key = 5 expression into the select clause as a constant 
(i.e. select 5 key, f1 FROM tbl1 where key = 5).  After it gets converted back 
into AST and then re-compiled, there is code in the common group method that 
expects all columns to be non-constants which is causing the failiure.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to