VenuReddy2103 commented on pull request #3788:
URL: https://github.com/apache/carbondata/pull/3788#issuecomment-662573078


   If MV is in different database than that of its source tables, then we will 
not be able to rewrite the plan. Consider below inner join example.
   `spark.sql("create database db1")
   spark.sql("create database db2")
   spark.sql("create database db3")
   spark.sql("use db1")
   spark.sql("create table db1_table(a int, b int) stored as carbondata")
   spark.sql("insert into db1_table select 1, 2")
   spark.sql("use db2")
   spark.sql("create table db2_table(i int, j int) stored as carbondata")
   spark.sql("insert into db2_table select 1, 4")
   spark.sql("use db3")
   spark.sql("create materialized view db3_mv as select t1.a,t2.i from 
db1.db1_table t1,db2.db2_table t2 where t1.a=t2.i")
   spark.sql("explain select t1.a, t2.i from db1.db1_table t1, db2.db2_table t2 
where t1.a=t2.i").show(100, false)`
   
   if we get `getValidSchemas` only from `db1` and `db2` in `hasSuitableMV()`. 
We don't find one and do not rewrite the plan.


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

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to