dengzhhu653 commented on code in PR #6700:
URL: https://github.com/apache/hive/pull/6700#discussion_r3808963944


##########
ql/src/test/org/apache/hadoop/hive/ql/parse/TestSemanticAnalyzer.java:
##########
@@ -545,4 +546,60 @@ private void testMaterializeCTEUsesDDLFactory(boolean 
cboEnabled) throws Excepti
           cteAnalyzer[0] instanceof CreateTableAnalyzer);
     }
   }
+
+  @Test
+  public void testMaterializedCteInputsAndColumnAccess() throws Exception {
+    createKeyValueTable("src");
+
+    HiveConf testConf = new HiveConf(conf);
+    testConf.setIntVar(HiveConf.ConfVars.HIVE_CTE_MATERIALIZE_THRESHOLD, 1);
+    
testConf.setBoolVar(HiveConf.ConfVars.HIVE_CTE_MATERIALIZE_FULL_AGGREGATE_ONLY, 
false);
+    testConf.setBoolVar(HiveConf.ConfVars.HIVE_STATS_COLLECT_SCANCOLS, true);
+
+    SessionState.start(testConf);
+    String[] queries = {
+        "with q1 as ( select key from q2 where key = '5'),"
+            + "q2 as ( select key from src where key = '5') "
+            + "select * from (select key from q1) a",
+        "WITH q1 AS ("
+            + "WITH q2 AS (SELECT key, value FROM src WHERE key = '4') "
+            + "SELECT * FROM q2 UNION ALL SELECT * FROM q2) "
+            + "SELECT * FROM q1 t1 JOIN q1 t2 ON t1.key = t2.key"
+    };

Review Comment:
   ack, one query is chained cte, the other is nested cte, will create a 
separate class for the test



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to