[GitHub] [carbondata] VenuReddy2103 commented on a change in pull request #4000: [CARBONDATA-4020] Fixed drop index when multiple index exists

2020-11-29 Thread GitBox


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



##
File path: 
integration/spark/src/test/scala/org/apache/carbondata/index/bloom/BloomCoarseGrainIndexFunctionSuite.scala
##
@@ -660,6 +660,20 @@ 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'='64', 'BLOOM_FPP'='0.1', 
'BLOOM_COMPRESS'='true')")
+sql(s"CREATE index index2 ON TABLE $bloomSampleTable (name) as 
'bloomfilter' " +
+  "PROPERTIES ('BLOOM_SIZE'='64', 'BLOOM_FPP'='0.1', 
'BLOOM_COMPRESS'='true')")
+sql(s"insert into $bloomSampleTable values(1,'nihal',20)")
+sql(s"SHOW INDEXES ON TABLE $bloomSampleTable").collect()

Review comment:
   This line can be removed.





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




[GitHub] [carbondata] VenuReddy2103 commented on a change in pull request #4000: [CARBONDATA-4020] Fixed drop index when multiple index exists

2020-11-26 Thread GitBox


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



##
File path: 
integration/spark/src/main/scala/org/apache/spark/sql/execution/command/index/DropIndexCommand.scala
##
@@ -184,10 +184,12 @@ 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) {
+  // check if any CG or FG index exists. If not exists,
+  // then set indexExists as false to return empty index list for next 
query.
+  val hasCgFgIndexes = indexMetadata.getIndexesMap.size() != 0 &&

Review comment:
   I understand that `indexMetadata` will have SI indexes as well. But, 
What i meant was indexMetadata.getIndexesMap.size() != 0 always evaluates to 
true at line 189. 





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




[GitHub] [carbondata] VenuReddy2103 commented on a change in pull request #4000: [CARBONDATA-4020] Fixed drop index when multiple index exists

2020-11-26 Thread GitBox


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



##
File path: 
integration/spark/src/main/scala/org/apache/spark/sql/execution/command/index/DropIndexCommand.scala
##
@@ -184,10 +184,12 @@ 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) {
+  // check if any CG or FG index exists. If not exists,
+  // then set indexExists as false to return empty index list for next 
query.
+  val hasCgFgIndexes = indexMetadata.getIndexesMap.size() != 0 &&

Review comment:
   Got 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:
us...@infra.apache.org




[GitHub] [carbondata] VenuReddy2103 commented on a change in pull request #4000: [CARBONDATA-4020] Fixed drop index when multiple index exists

2020-11-26 Thread GitBox


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



##
File path: 
integration/spark/src/main/scala/org/apache/spark/sql/execution/command/index/DropIndexCommand.scala
##
@@ -184,10 +184,12 @@ 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) {
+  // check if any CG or FG index exists. If not exists,

Review comment:
   For example, create 2 bloom indexes, Drop both of them. In last index 
drop, `indexMetadata` will be null at this point(line 186). We do not seem to 
set `indexExists` property to `false` in that case.





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




[GitHub] [carbondata] VenuReddy2103 commented on a change in pull request #4000: [CARBONDATA-4020] Fixed drop index when multiple index exists

2020-11-26 Thread GitBox


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



##
File path: 
integration/spark/src/main/scala/org/apache/spark/sql/execution/command/index/DropIndexCommand.scala
##
@@ -184,10 +184,12 @@ 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) {
+  // check if any CG or FG index exists. If not exists,
+  // then set indexExists as false to return empty index list for next 
query.
+  val hasCgFgIndexes = indexMetadata.getIndexesMap.size() != 0 &&

Review comment:
   `indexMetadata.getIndexesMap.size() != 0` would always be true at this 
point. `indexMetadata` will be null if empty.  It is redundant check.





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




[GitHub] [carbondata] VenuReddy2103 commented on a change in pull request #4000: [CARBONDATA-4020] Fixed drop index when multiple index exists

2020-11-26 Thread GitBox


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



##
File path: 
integration/spark/src/main/scala/org/apache/spark/sql/execution/command/index/DropIndexCommand.scala
##
@@ -184,10 +184,12 @@ 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) {
+  // check if any CG or FG index exists. If not exists,
+  // then set indexExists as false to return empty index list for next 
query.
+  val hasCgFgIndexes = indexMetadata.getIndexesMap.size() != 0 &&

Review comment:
   `indexMetadata.getIndexesMap.size() != 0` would always be true at this 
point. `indexMetadata` will be null if empty. 





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