You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@carbondata.apache.org by GitBox <gi...@apache.org> on 2021/06/08 09:58:57 UTC

[GitHub] [carbondata] Indhumathi27 commented on a change in pull request #4147: [CARBONDATA-4202] Fix issue when refresh main table with MV

Indhumathi27 commented on a change in pull request #4147:
URL: https://github.com/apache/carbondata/pull/4147#discussion_r647299409



##########
File path: integration/spark/src/test/scala/org/apache/spark/carbondata/register/TestRegisterCarbonTable.scala
##########
@@ -231,6 +232,45 @@ class TestRegisterCarbonTable extends QueryTest with BeforeAndAfterEach {
     }
   }
 
+  test("test register table with mv") {
+    sql(s"create database carbon location '$dbLocation'")
+    sql("use carbon")
+    sql(
+      """create table carbon.carbontable (
+        |c1 string,c2 int,c3 string,c5 string) STORED AS carbondata""".stripMargin)
+    sql("insert into carbontable select 'a',1,'aa','aaa'")
+    sql("create materialized view mv1 as select avg(c2),c3 from carbontable group by c3")
+    backUpData(dbLocation, Some("carbon"), "carbontable")
+    backUpData(dbLocation, Some("carbon"), "mv1")
+    val source = dbLocation + CarbonCommonConstants.FILE_SEPARATOR + "_system" +
+                 CarbonCommonConstants.FILE_SEPARATOR + "mv_schema.mv1"
+    val destination = dbLocation + "_back" + CarbonCommonConstants.FILE_SEPARATOR + "mv_schema.mv1"
+    backUpMvSchema(source, destination)
+    sql("drop table carbontable")
+    if (!CarbonEnv.getInstance(sqlContext.sparkSession).carbonMetaStore.isReadFromHiveMetaStore) {
+      restoreData(dbLocation, "carbontable")
+      restoreData(dbLocation, "mv1")
+      backUpMvSchema(destination, source)
+      sql("refresh table carbontable")
+      sql("refresh table mv1")
+      sql("refresh materialized view mv1")
+      checkAnswer(sql("select count(*) from carbontable"), Row(1))
+      checkAnswer(sql("select c1 from carbontable"), Seq(Row("a")))
+      sql("show materialized views on table carbontable").show(false)

Review comment:
       please remove this show




-- 
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:
users@infra.apache.org