kasakrisz commented on code in PR #6423: URL: https://github.com/apache/hive/pull/6423#discussion_r3226603077
########## 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: The problem with the non-CBO path—whether by turning CBO off or falling back to it—is that many Hive features, such as set operations and subqueries, and others, do not work on this path. Furthermore, falling back hides the real cause of a query failure: the query fails with CBO enabled, falls back to the non-CBO path, and then fails again, resulting in only the second error being shown to the user. The original (and often more relevant) error is only available in the hive.log. -- 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]
