VenuReddy2103 commented on a change in pull request #4071:
URL: https://github.com/apache/carbondata/pull/4071#discussion_r566602925



##########
File path: 
index/secondary-index/src/test/scala/org/apache/carbondata/spark/testsuite/mergedata/CarbonDataFileMergeTestCaseOnSI.scala
##########
@@ -327,6 +259,35 @@ class CarbonDataFileMergeTestCaseOnSI
       .queryExecution.sparkPlan
     assert(getDataFileCount("nonindexmerge_index1", "0") == 100)
     assert(getDataFileCount("nonindexmerge_index1", "1") == 100)
+
+    // exception is thrown by compaction executor
+    val mock3 = TestSecondaryIndexUtils.mockCompactionExecutor()
+    val exception2 = intercept[Exception] {
+      sql("REFRESH INDEX nonindexmerge_index1 ON TABLE 
nonindexmerge").collect()
+    }
+    mock3.tearDown()
+    assert(exception2.getMessage.contains("Merge data files Failure in Merger 
Rdd."))
+    df1 = sql("""Select * from nonindexmerge where name='n16000'""")
+        .queryExecution.sparkPlan
+    assert(getDataFileCount("nonindexmerge_index1", "0") == 100)
+    assert(getDataFileCount("nonindexmerge_index1", "1") == 100)
+    
CarbonProperties.getInstance().addProperty(CarbonCommonConstants.CARBON_SI_SEGMENT_MERGE,
+      CarbonCommonConstants.CARBON_SI_SEGMENT_MERGE_DEFAULT)
+  }
+
+  test("test refresh index command when block need to be sorted") {
+    CarbonProperties.getInstance()
+        .addProperty(CarbonCommonConstants.CARBON_SI_SEGMENT_MERGE, "false")
+    createTableAndLoadData("100", 2)
+    sql("CREATE INDEX nonindexmerge_index1 on table nonindexmerge (name) AS 
'carbondata'")
+    val mock = TestSecondaryIndexUtils.mockIsSortRequired();
+    sql("REFRESH INDEX nonindexmerge_index1 ON TABLE nonindexmerge").collect()
+    mock.tearDown()
+    val df1 = sql("""Select * from nonindexmerge where name='n16000'""")
+        .queryExecution.sparkPlan
+    assert(isFilterPushedDownToSI(df1))
+    assert(getDataFileCount("nonindexmerge_index1", "0") < 15)
+    assert(getDataFileCount("nonindexmerge_index1", "1") < 15)

Review comment:
       CarbonCommonConstants.CARBON_SI_SEGMENT_MERGE property is set to "false" 
at beginning and end of testcase. Note that 
CarbonCommonConstants.CARBON_SI_SEGMENT_MERGE_DEFAULT value is also "false".  
Why set to false second time ? You might want to set to true at the end of 
testcase.
   
   Same issue observed in following testcases. Please recheck for all of these 
cases.
   `test("Verify data file merge in SI segments with sort scope as gloabl sort 
and" +
       "CARBON_SI_SEGMENT_MERGE property is enabled")`
   `test("Verify REFRESH INDEX command with sort scope as global sort")`
   `test("test verify data file merge when exception occurred in rebuild 
segment")`
   `test("test refresh index command when block need to be sorted")`




----------------------------------------------------------------
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


Reply via email to