ajantha-bhat commented on a change in pull request #4072:
URL: https://github.com/apache/carbondata/pull/4072#discussion_r580013774
##########
File path:
integration/spark/src/test/scala/org/apache/carbondata/spark/testsuite/cleanfiles/TestCleanFileCommand.scala
##########
@@ -466,6 +485,39 @@ class TestCleanFileCommand extends QueryTest with
BeforeAndAfterAll {
CarbonCommonConstants.CARBON_CLEAN_FILES_FORCE_ALLOWED_DEFAULT)
}
+ test("Test clean files after delete command") {
+ CarbonProperties.getInstance()
+ .addProperty(CarbonCommonConstants.CARBON_CLEAN_FILES_FORCE_ALLOWED,
"true")
+ sql("drop table if exists cleantest")
+ sql(
+ """
+ | CREATE TABLE cleantest (empname String, designation String, doj
Timestamp,
+ | workgroupcategory int, workgroupcategoryname String, deptno int,
deptname String,
+ | projectcode int, projectjoindate Timestamp, projectenddate
Date,attendance int,
+ | utilization int,salary int, empno int)
+ | STORED AS carbondata
+ """.stripMargin)
+ sql(
+ s"""LOAD DATA local inpath '$resourcesPath/data.csv' INTO TABLE
cleantest OPTIONS
+ |('DELIMITER'= ',', 'QUOTECHAR'= '"')""".stripMargin)
+ val table = CarbonEnv.getCarbonTable(None, "cleantest")
(sqlContext.sparkSession)
+ sql("delete from cleantest where deptno='10'")
+ sql(s"""Delete from table cleantest where segment.id in(0)""")
+
+ var dryRun = sql(s"CLEAN FILES FOR TABLE cleantest
OPTIONS('dryrun'='true')").collect()
+ var cleanFiles = sql(s"CLEAN FILES FOR TABLE cleantest").collect()
+ assert(cleanFiles(0).get(0) == dryRun(0).get(0))
+ dryRun = sql(s"CLEAN FILES FOR TABLE cleantest
OPTIONS('dryrun'='true','force'='true')")
+ .collect()
+ cleanFiles = sql(s"CLEAN FILES FOR TABLE cleantest
OPTIONS('force'='true')").collect()
+ assert(cleanFiles(0).get(0) == dryRun(0).get(0))
Review comment:
can you add one validation by doing getSegmentSize() and compare it with
clean files output ? If some problem in statistics current validations may not
catch it
----------------------------------------------------------------
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:
[email protected]