[CARBONDATA-4326] MV not hitting with multiple sessions issue fix
authorShreelekhyaG <shreelu_gampa@yahoo.com>
Wed, 2 Mar 2022 15:28:14 +0000 (20:58 +0530)
committerIndhumathi27 <indhumathim27@gmail.com>
Fri, 4 Mar 2022 08:10:28 +0000 (13:40 +0530)
commit19343a7f8ce43929cdefc96a1d8a9344de280295
treefd8eb6c75580b2191cf37fed4579a721c9caaec1
parentc840b5f30b15df54778b2a83608c727d25553d7c
[CARBONDATA-4326] MV not hitting with multiple sessions issue fix

Why is this PR needed?
MV created in beeline not hitting in sql/shell and vice versa if both
beeline and sql/shell are running in parallel. Currently, If the view
catalog for a particular session is already initialized then the schemas
are not reloaded each time. So when mv is created in another session
and queried from the currently open session, mv is not hit.

What changes were proposed in this PR?
1.Reload mv catalog every time to getSchemas from the path. Register the
schema if not present in the catalog and deregister the schema if it's dropped.
2. When create SI is triggered, no need to try rewriting the plan and
check for mv schemas. So, returning plan if DeserializeToObject is present.

Does this PR introduce any user interface change?
No

Is any new testcase added?
No, tested in cluster

This closes #4251
core/src/main/java/org/apache/carbondata/core/view/MVManager.java
integration/spark/src/main/scala/org/apache/carbondata/view/MVManagerInSpark.scala
integration/spark/src/main/scala/org/apache/spark/sql/execution/command/view/CarbonCreateMVCommand.scala
integration/spark/src/main/scala/org/apache/spark/sql/execution/command/view/CarbonRefreshMVCommand.scala
integration/spark/src/main/scala/org/apache/spark/sql/optimizer/MVRewriteRule.scala