jyothsnakonisa commented on code in PR #220:
URL:
https://github.com/apache/cassandra-analytics/pull/220#discussion_r3581765100
##########
cassandra-four-zero-types/src/main/java/org/apache/cassandra/spark/reader/SchemaBuilder.java:
##########
@@ -222,6 +224,20 @@ private static Pair<KeyspaceMetadata, TableMetadata>
updateSchema(Schema schema,
}
tableMetadata.columns().forEach(columnValidator);
+
+ // This builder always produces an index-less table (indexes are
applied later by the 5.0 bridge), so a
+ // rebuild never carries indexes even if the caller passed index
statements. buildSchema runs repeatedly per
+ // table in a JVM; if an earlier call already registered indexes, copy
them onto this rebuild so it matches
+ // the registered table.
+ if (maybeExistingTableMetadata != null
+ && !maybeExistingTableMetadata.indexes.isEmpty()
+ && tableMetadata.indexes.isEmpty())
+ {
+ tableMetadata = tableMetadata.unbuild()
+
.indexes(maybeExistingTableMetadata.indexes)
+ .build();
+ }
+
Review Comment:
@skoppu22 This block of code is moved to
`FiveZeroSchemaBuilder.beforeTableRegistered` but the issue still exists. You
can get rid of the logic to not drop indexes in beforeTableRegistered and even
the method `beforeTableRegistered` if you use 8 argument constructor for
schemaBuilder in Recordwriter passing `
writerContext.schema().getTableSchema().getIndexStatements()` in the
constructor.
--
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]