okumin commented on code in PR #5089:
URL: https://github.com/apache/hive/pull/5089#discussion_r1497750123


##########
ql/src/test/queries/clientpositive/cte_mat_11.q:
##########
@@ -0,0 +1,15 @@
+--! qt:dataset:src
+set hive.optimize.cte.materialize.threshold=2;
+set hive.optimize.cte.materialize.full.aggregate.only=false;
+
+EXPLAIN WITH materialized_cte1 AS (
+  SELECT * FROM src
+),
+materialized_cte2 AS (
+  SELECT *
+  FROM materialized_cte1 a
+  JOIN materialized_cte1 b ON (a.key = b.key)
+)
+SELECT *
+FROM materialized_cte2 a
+JOIN materialized_cte2 b ON (a.key = b.key);

Review Comment:
   @kasakrisz, I see. I also observed CBO failed on both this branch and the 
master branch.
   
   Do you think the following remediations make sense?
   - I will create another ticket to resolve the CBO + CTE issue. We need it by 
[we deprecate the non-CBO 
mode](https://issues.apache.org/jira/browse/HIVE-27831) anyway
   - I will add a test query if we want to test `CalcitePlanner#materializeCTE.`
       - IMO, this is not just because some test cases, such as `cte_mat_3.q`, 
don't hit the CBO issue and cover CalcitePlanner. But I definitely follow your 
opinion



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