konstantinb commented on code in PR #6423: URL: https://github.com/apache/hive/pull/6423#discussion_r3164344467
########## ql/src/test/queries/clientpositive/cte_materialize.q: ########## @@ -0,0 +1,46 @@ +-- Test CTE materialization with both CBO enabled and disabled +-- Verifies DDLSemanticAnalyzerFactory is used for CTE materialization +-- Also ensures that an NPE is no longer triggered with CBO off (HIVE-28724 regression) + +-- Test with CBO enabled (default) +explain +WITH cte AS ( + SELECT COUNT(*) as cnt FROM (SELECT 1 as id) t +) +SELECT * FROM cte +UNION ALL +SELECT * FROM cte +UNION ALL +SELECT * FROM cte; + +-- Test with CBO disabled +set hive.cbo.enable=false; + +explain +WITH cte AS ( + SELECT COUNT(*) as cnt FROM (SELECT 1 as id) t +) +SELECT * FROM cte +UNION ALL +SELECT * FROM cte +UNION ALL +SELECT * FROM cte; + +-- Test the recompile-without-CBO auto-trigger path. Review Comment: I've left very verbose comments in here to better explain the scenario. I will gladly remove or shorten this comment section once reviewed -- 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]
