maheshrajus commented on code in PR #4276: URL: https://github.com/apache/carbondata/pull/4276#discussion_r908072157
########## integration/spark/src/test/scala/org/apache/carbondata/spark/testsuite/standardpartition/StandardPartitionTableDropTestCase.scala: ########## @@ -218,6 +222,129 @@ class StandardPartitionTableDropTestCase extends QueryTest with BeforeAndAfterAl Seq(Row(0))) } + test("dropping partition with moving data to trash") { + sql("drop table if exists dropPartition1") + sql( + """ + | CREATE TABLE dropPartition1 (empno int, empname String, designation String, + | workgroupcategory int, workgroupcategoryname String, deptno int, + | projectjoindate Timestamp, projectenddate Date,attendance int, + | utilization int,salary int) + | PARTITIONED BY (deptname String,doj Timestamp,projectcode int) + | STORED AS carbondata + """.stripMargin) + sql( + s"""LOAD DATA local inpath '$resourcesPath/data.csv' INTO TABLE dropPartition1 OPTIONS + |('DELIMITER'= ',', 'QUOTECHAR'= '"')""".stripMargin) + sql( + s"""LOAD DATA local inpath '$resourcesPath/data.csv' INTO TABLE dropPartition1 OPTIONS + |('DELIMITER'= ',', 'QUOTECHAR'= '"')""".stripMargin) + sql( + s"""LOAD DATA local inpath '$resourcesPath/data.csv' INTO TABLE dropPartition1 OPTIONS + |('DELIMITER'= ',', 'QUOTECHAR'= '"')""".stripMargin) + sql( + s"""LOAD DATA local inpath '$resourcesPath/data.csv' INTO TABLE dropPartition1 OPTIONS + |('DELIMITER'= ',', 'QUOTECHAR'= '"')""".stripMargin) + sql(s"""ALTER TABLE dropPartition1 DROP PARTITION(deptname='Learning')""") + sql(s"""ALTER TABLE dropPartition1 DROP PARTITION(deptname='configManagement')""") + sql(s"""ALTER TABLE dropPartition1 DROP PARTITION(deptname='network')""") + sql(s"""ALTER TABLE dropPartition1 DROP PARTITION(deptname='protocol')""") + sql(s"""ALTER TABLE dropPartition1 DROP PARTITION(deptname='security')""") + val table = CarbonEnv.getCarbonTable(Option("default"), "dropPartition1")(sqlContext + .sparkSession) + val tablePath = table.getTablePath + val deptname = FileFactory.getCarbonFile(tablePath).listFiles().filter{ + file => file.getName.equalsIgnoreCase("deptname=Learning") + } + assert(deptname.length == 0) + val configManagement = FileFactory.getCarbonFile(tablePath).listFiles().filter{ + file => file.getName.equalsIgnoreCase("deptname=configManagement") + } + assert(configManagement.length == 0) + val network = FileFactory.getCarbonFile(tablePath).listFiles().filter{ + file => file.getName.equalsIgnoreCase("deptname=network") + } + assert(network.length == 0) + val protocol = FileFactory.getCarbonFile(tablePath).listFiles().filter{ + file => file.getName.equalsIgnoreCase("deptname=protocol") + } + assert(protocol.length == 0) + val security = FileFactory.getCarbonFile(tablePath).listFiles().filter{ + file => file.getName.equalsIgnoreCase("deptname=protocol") + } + assert(security.length == 0) + sql("drop table if exists dropPartition1") Review Comment: done -- 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: dev-unsubscr...@carbondata.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org