zabetak commented on code in PR #4783:
URL: https://github.com/apache/hive/pull/4783#discussion_r1356748227


##########
ql/src/test/queries/clientpositive/multi_insert_gby5.q:
##########
@@ -0,0 +1,24 @@
+set hive.cbo.fallback.strategy=NEVER;
+set hive.stats.column.autogather=false;
+
+CREATE TABLE tbl1 (key int, f1 int);
+CREATE TABLE tbl2 (f1 int) PARTITIONED BY (key int);
+
+INSERT INTO tbl1 values (5, 8);
+INSERT INTO tbl1 values (6, 9);
+INSERT INTO tbl1 values (7, 10);
+INSERT INTO tbl1 values (-1, 11);
+
+EXPLAIN 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;
+
+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;

Review Comment:
   I think I found a smaller repro for the problem encountered here.
   ```sql
   CREATE TABLE target1 (tc int);
   CREATE TABLE target2 (tc int);
   
   EXPLAIN FROM (SELECT 100 as sa, 200 as sb) source
   INSERT OVERWRITE TABLE target1 SELECT sa WHERE sb > 0 GROUP BY sa
   INSERT OVERWRITE TABLE target2 SELECT sa GROUP BY sa;
   ```
   The query above fails no matter if CBO is enabled or not. Likely, the fix in 
this PR covers this query as well.
   
   The PR is ready to merge, the only thing remaining is to see if we want to 
include this minimal repro or not



-- 
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


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org
For additional commands, e-mail: gitbox-h...@hive.apache.org

Reply via email to