marchpure commented on a change in pull request #3947: URL: https://github.com/apache/carbondata/pull/3947#discussion_r494968395
########## File path: integration/spark/src/test/scala/org/apache/carbondata/view/timeseries/TestCreateMVWithTimeSeries.scala ########## @@ -167,18 +182,24 @@ class TestCreateMVWithTimeSeries extends QueryTest with BeforeAndAfterAll { test("insert and create materialized view in progress") { sql("drop materialized view if exists mv1") - val query = s"LOAD DATA local inpath '$resourcesPath/data_big.csv' INTO TABLE maintable " + - s"OPTIONS('DELIMITER'= ',')" - val executorService = Executors.newFixedThreadPool(4) - executorService.submit(new QueryTask(query)) - intercept[UnsupportedOperationException] { - sql( - "create materialized view mv1 as " + + + val future = AsyncExecutorUtils.runSqlAsync("insert overwrite table maintable select * from temp_maintable") + val ex = intercept[UnsupportedOperationException] { + sql("create materialized view mv1 as " + "select timeseries(projectjoindate,'year'), sum(projectcode) from maintable group by timeseries(projectjoindate,'year')") - }.getMessage - .contains("Cannot create mv materialized view table when insert is in progress on parent table: maintable") - executorService.shutdown() - executorService.awaitTermination(2, TimeUnit.HOURS) + } + assert(future.get.contains("PASS")) + assert(ex.getMessage.contains("Cannot create mv when insert overwrite is in progress on table default_maintable")) + sql("drop materialized view if exists mv1") + } + + test("create materialized view should success when parent table is insert in progress") { + sql("drop materialized view if exists mv1") + + val future = AsyncExecutorUtils.runSqlAsync("insert into table maintable select * from temp_maintable") + sql("create materialized view mv1 as " + Review comment: Need to check result of 'create materialized view' ########## File path: integration/spark/src/test/scala/org/apache/carbondata/view/timeseries/TestCreateMVWithTimeSeries.scala ########## @@ -33,17 +34,30 @@ class TestCreateMVWithTimeSeries extends QueryTest with BeforeAndAfterAll { override def beforeAll(): Unit = { CarbonProperties.getInstance().addProperty(CarbonCommonConstants.CARBON_TIMESTAMP_FORMAT, "dd-MM-yyyy") - drop() + dropTable() sql("CREATE TABLE maintable (empname String, designation String, doj Timestamp, workgroupcategory int, workgroupcategoryname String, deptno int, " + - "deptname String, projectcode int, projectjoindate Timestamp, projectenddate Timestamp,attendance int, utilization int,salary int) STORED AS carbondata") + "deptname String, projectcode int, projectjoindate Timestamp, projectenddate Timestamp,attendance int, utilization int,salary int) STORED AS carbondata") Review comment: take care about the format ########## File path: integration/spark/src/test/scala/org/apache/carbondata/view/timeseries/TestCreateMVWithTimeSeries.scala ########## @@ -33,17 +34,30 @@ class TestCreateMVWithTimeSeries extends QueryTest with BeforeAndAfterAll { override def beforeAll(): Unit = { CarbonProperties.getInstance().addProperty(CarbonCommonConstants.CARBON_TIMESTAMP_FORMAT, "dd-MM-yyyy") - drop() + dropTable() sql("CREATE TABLE maintable (empname String, designation String, doj Timestamp, workgroupcategory int, workgroupcategoryname String, deptno int, " + - "deptname String, projectcode int, projectjoindate Timestamp, projectenddate Timestamp,attendance int, utilization int,salary int) STORED AS carbondata") + "deptname String, projectcode int, projectjoindate Timestamp, projectenddate Timestamp,attendance int, utilization int,salary int) STORED AS carbondata") + sql(s""" + | CREATE INDEX maintable_index_test + | ON TABLE maintable (designation) + | AS '${classOf[WaitingIndexFactory].getName}' + """.stripMargin) + sql(s"""LOAD DATA local inpath '$resourcesPath/data_big.csv' INTO TABLE maintable OPTIONS |('DELIMITER'= ',', 'QUOTECHAR'= '"')""".stripMargin) + + sql("CREATE TABLE temp_maintable (empname String, designation String, doj Timestamp, workgroupcategory int, workgroupcategoryname String, deptno int, " + Review comment: create table again? ---------------------------------------------------------------- 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