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


##########
ql/src/test/queries/clientpositive/empty_result_correlate2.q:
##########
@@ -0,0 +1,22 @@
+set hive.support.concurrency=true;
+set hive.txn.manager=org.apache.hadoop.hive.ql.lockmgr.DbTxnManager;
+
+-- To create a HiveValues operator before decorrelation automatic query 
rewrite with
+-- materialized views is used.
+-- All tables must be transactional to trigger automatic query rewrite.
+create table mv_source (any_col int) stored as orc TBLPROPERTIES 
('transactional'='true');
+create table t1 (a int, b int) stored as orc TBLPROPERTIES 
('transactional'='true');
+create table t2 (a int, b int) stored as orc TBLPROPERTIES 
('transactional'='true');
+
+-- At least one materialized view must exist.
+create materialized view any_mv as
+select any_col from mv_source where any_col > 20;
+
+-- Automatic query rewrite traverses the plan and recreates the HiveFilter 
using RelBuilder.
+-- If the condition is always false, it replaces the filter with HiveValues.
+explain cbo
+select * from t1 where 1 = 2
+union
+select * from t1
+where exists (select a from t2 where t1.a > 10)

Review Comment:
   I guess the empty branch can be removed by 
`HiveRemoveEmptySingleRules#UNION_INSTANCE` but in order for  this work the 
rule should run before the decorrelator. Anyways, at this stage changing the 
decorrelator is probably a safer and better change than applying the removal 
rules in a different place.



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