Indhumathi27 commented on a change in pull request #4112: URL: https://github.com/apache/carbondata/pull/4112#discussion_r599530878
########## File path: index/secondary-index/src/test/scala/org/apache/carbondata/spark/testsuite/secondaryindex/TestSIWithPartition.scala ########## @@ -460,6 +461,60 @@ class TestSIWithPartition extends QueryTest with BeforeAndAfterAll { Row(2, "red", "def2", 22), Row(5, "red", "abc", 22))) assert(extSegmentQuery.queryExecution.executedPlan.isInstanceOf[BroadCastSIFilterPushJoin]) sql("drop table if exists partition_table") + FileFactory.deleteAllCarbonFilesOfDir(FileFactory.getCarbonFile(sdkWritePath1)) + FileFactory.deleteAllCarbonFilesOfDir(FileFactory.getCarbonFile(sdkWritePath2)) + } + + test("test si with add partition based on empty location on partition table") { + sql("drop table if exists partitionTable") + sql( + """create table partition_table (id int,name String) partitioned by(email string) + stored as carbondata""".stripMargin) + sql("CREATE INDEX partitionTable_si on table partition_table (name) as 'carbondata'") + sql("insert into partition_table select 1,'blue','abc'") + val location = target + "/" + "def" + FileFactory.deleteAllCarbonFilesOfDir(FileFactory.getCarbonFile(location)) + sql(s"""alter table partition_table add partition (email='def') location '$location'""") + sql("insert into partition_table select 2,'red','def'") + var extSegmentQuery = sql("select * from partition_table where name = 'red'") + checkAnswer(extSegmentQuery, Seq(Row(2, "red", "def"))) + sql("insert into partition_table select 4,'grey','bcd'") + sql("insert into partition_table select 5,'red','abc'") + sql("alter table partition_table compact 'minor'") + extSegmentQuery = sql("select * from partition_table where name = 'red'") + checkAnswer(extSegmentQuery, Seq(Row(2, "red", "def"), Row(5, "red", "abc"))) + assert(extSegmentQuery.queryExecution.executedPlan.isInstanceOf[BroadCastSIFilterPushJoin]) + sql("drop table if exists partition_table") + FileFactory.deleteAllCarbonFilesOfDir(FileFactory.getCarbonFile(location)) + } + + test("test si with add multiple partitions based on empty location on partition table") { + sql("drop table if exists partition_table") + sql("create table partition_table (id int,name String) " + + "partitioned by(email string, age int) stored as carbondata") + sql("insert into partition_table select 1,'blue','abc', 20") + sql("CREATE INDEX partitionTable_si on table partition_table (name) as 'carbondata'") + val location1 = target + "/" + "def" + val location2 = target + "/" + "def2" + FileFactory.deleteAllCarbonFilesOfDir(FileFactory.getCarbonFile(location1)) + FileFactory.deleteAllCarbonFilesOfDir(FileFactory.getCarbonFile(location2)) + sql( Review comment: please move these changes to existing testcase and add drop external partition scenario also -- 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