skoppu22 commented on code in PR #220:
URL: 
https://github.com/apache/cassandra-analytics/pull/220#discussion_r3530514721


##########
cassandra-five-zero-bridge/src/main/java/org/apache/cassandra/bridge/CassandraBridgeImplementation.java:
##########
@@ -281,10 +282,17 @@ public CqlTable buildSchema(String createStatement,
                                 Partitioner partitioner,
                                 Set<String> udts,
                                 @Nullable UUID tableId,
-                                int indexCount,
+                                Set<String> indexStatements,
                                 boolean enableCdc)
     {
-        return new SchemaBuilder(createStatement, keyspace, replicationFactor, 
partitioner, cassandraTypes -> udts, tableId, indexCount, enableCdc).build();
+        CqlTable cqlTable = new SchemaBuilder(createStatement, keyspace, 
replicationFactor, partitioner,
+                                              cassandraTypes -> udts, tableId, 
indexStatements, enableCdc).build();
+        // SAI is a Cassandra 5.0+ feature: register any Storage Attached 
Index definitions on the table metadata
+        // after the shared SchemaBuilder has built/registered the 
(index-less) table.
+        // buildSchema is invoked repeatedly within a JVM (the index-carrying 
per-partition RecordWriter included),
+        // so this re-applies the SAI definitions whenever a rebuild left the 
table without them.
+        StorageAttachedIndexApplier.maybeApply(keyspace, cqlTable.table(), 
indexStatements);
+        return cqlTable;

Review Comment:
   Done by passing a afterRegister function as a param



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