Indhumathi27 commented on a change in pull request #4000:
URL: https://github.com/apache/carbondata/pull/4000#discussion_r529229059



##########
File path: 
integration/spark/src/test/scala/org/apache/carbondata/index/bloom/BloomCoarseGrainIndexFunctionSuite.scala
##########
@@ -660,6 +660,22 @@ class BloomCoarseGrainIndexFunctionSuite
       sql(s"SELECT * FROM $normalTable WHERE salary='1040'"))
   }
 
+  test("test drop index when more than one bloom index exists") {
+    sql(s"CREATE TABLE $bloomSampleTable " +
+      "(id int,name string,salary int)STORED as carbondata 
TBLPROPERTIES('SORT_COLUMNS'='id')")
+    sql(s"CREATE index index1 ON TABLE $bloomSampleTable(id) as 'bloomfilter' 
" +
+      "PROPERTIES ( 'BLOOM_SIZE'='640000', 'BLOOM_FPP'='0.00001', 
'BLOOM_COMPRESS'='true')")
+    sql(s"CREATE index index2 ON TABLE $bloomSampleTable (name) as 
'bloomfilter' " +
+      "PROPERTIES ('BLOOM_SIZE'='640000', 'BLOOM_FPP'='0.00001', 
'BLOOM_COMPRESS'='true')")
+    sql(s"insert into $bloomSampleTable values(1,'nihal',20)")
+    sql(s"SHOW INDEXES ON TABLE $bloomSampleTable").collect()
+    checkExistence(sql(s"SHOW INDEXES ON TABLE $bloomSampleTable"), true, 
"index1")

Review comment:
       ```suggestion
       checkExistence(sql(s"SHOW INDEXES ON TABLE $bloomSampleTable"), true, 
"index1", "index2" )
   ```
   Remove next line

##########
File path: 
integration/spark/src/test/scala/org/apache/carbondata/index/bloom/BloomCoarseGrainIndexFunctionSuite.scala
##########
@@ -660,6 +660,22 @@ class BloomCoarseGrainIndexFunctionSuite
       sql(s"SELECT * FROM $normalTable WHERE salary='1040'"))
   }
 
+  test("test drop index when more than one bloom index exists") {
+    sql(s"CREATE TABLE $bloomSampleTable " +
+      "(id int,name string,salary int)STORED as carbondata 
TBLPROPERTIES('SORT_COLUMNS'='id')")
+    sql(s"CREATE index index1 ON TABLE $bloomSampleTable(id) as 'bloomfilter' 
" +
+      "PROPERTIES ( 'BLOOM_SIZE'='640000', 'BLOOM_FPP'='0.00001', 
'BLOOM_COMPRESS'='true')")
+    sql(s"CREATE index index2 ON TABLE $bloomSampleTable (name) as 
'bloomfilter' " +
+      "PROPERTIES ('BLOOM_SIZE'='640000', 'BLOOM_FPP'='0.00001', 
'BLOOM_COMPRESS'='true')")
+    sql(s"insert into $bloomSampleTable values(1,'nihal',20)")
+    sql(s"SHOW INDEXES ON TABLE $bloomSampleTable").collect()
+    checkExistence(sql(s"SHOW INDEXES ON TABLE $bloomSampleTable"), true, 
"index1")
+    checkExistence(sql(s"SHOW INDEXES ON TABLE $bloomSampleTable"), true, 
"index2")
+    sql(s"drop index index1 on $bloomSampleTable")
+    sql(s"show indexes on table $bloomSampleTable").show()

Review comment:
       remove this line

##########
File path: 
integration/spark/src/main/scala/org/apache/spark/sql/execution/command/index/DropIndexCommand.scala
##########
@@ -184,10 +184,10 @@ private[sql] case class DropIndexCommand(
         parentCarbonTable = getRefreshedParentTable(sparkSession, dbName)
         val indexMetadata = parentCarbonTable.getIndexMetadata
         if (null != indexMetadata && null != indexMetadata.getIndexesMap) {
-          val hasCgFgIndexes =
-            !(indexMetadata.getIndexesMap.size() == 1 &&
-              
indexMetadata.getIndexesMap.containsKey(IndexType.SI.getIndexProviderName))
-          if (hasCgFgIndexes) {
+          val hasCgFgIndexes = indexMetadata.getIndexesMap.size() != 0 &&

Review comment:
       Please add a comment, on which case, we need to set 'indexExists' to 
false




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