maedhroz commented on code in PR #2433:
URL: https://github.com/apache/cassandra/pull/2433#discussion_r1242412630


##########
src/java/org/apache/cassandra/cql3/statements/schema/CreateIndexStatement.java:
##########
@@ -316,6 +318,23 @@ public CreateIndexStatement prepare(ClientState state)
 
             if (indexName.hasKeyspace() && 
!keyspaceName.equals(indexName.getKeyspace()))
                 throw ire(KEYSPACE_DOES_NOT_MATCH_INDEX, keyspaceName, 
tableName);
+            
+            // Set the configured default 2i implementation if one isn't 
specified with USING:
+            if (attrs.customClass == null)
+                if (DatabaseDescriptor.getDefaultSecondaryIndexEnabled())
+                    attrs.customClass = 
DatabaseDescriptor.getDefaultSecondaryIndex();
+                else
+                    // However, operators may require an implementation be 
specified
+                    throw ire(MUST_SPECIFY_INDEX_IMPLEMENTATION);
+            
+            // If we explicitly specify the index type "cassandra", we can 
just clear the custom class, and the
+            // non-custom 2i creation process will begin. Otherwise, if an 
index type has been specified with 
+            // USING, make sure the appropriate custom index is created.
+            if (attrs.customClass != null)
+                if (!attrs.isCustom && 
attrs.customClass.equalsIgnoreCase(CassandraIndex.NAME))

Review Comment:
   No. if the default is "sai", we need the value of `customClass` (which is 
"sai") to be retained, not discarded. This is to specifically reflect the fact 
that the "cassandra" or "legacy" type doesn't need a `customClass`.



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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to