Refactor Collection Table Matcher#2499
Conversation
…-backward-compatibility
…-backward-compatibility
makes CreateCollectionBackwardCompatibilityIntegrationTest work
|
|
||
| public static String errFmt(DataType dataType) { | ||
| return nullSafe(dataType, d -> d.asCql(true, true)); | ||
| return nullSafe(dataType, d -> d.asCql(false, true)); |
There was a problem hiding this comment.
change to not force frozen when it was not needed
| /** Physical table column name that stores the lexical content. */ | ||
| String LEXICAL_INDEX_COLUMN_NAME = "query_lexical_value"; | ||
| } | ||
|
|
There was a problem hiding this comment.
Moved all names of columns to be in SuperShreddingMetadata
📈 Unit Test Coverage Delta vs Main Branch
|
📉 Integration Test Coverage Delta vs Main Branch (dse69-it)
|
Integration Test Coverage Report (dse69-it)
|
📉 Integration Test Coverage Delta vs Main Branch (hcd-it)
|
Integration Test Coverage Report (hcd-it)
|
clun
left a comment
There was a problem hiding this comment.
Here are some findings and hopefully helpful new classes as a review
| protected final DataType type; | ||
|
|
||
| protected ColumnMetadataPredicate(CqlIdentifier name, DataType type) { | ||
| // no null checks in the ctor, so a subclass can fully override if they want to. |
There was a problem hiding this comment.
ok subclasses can fully override but they would also have to override the ToString or you raise a NPE.
i would not make name nor type Objects.requireNonNull() in the toString() or still add the test in the ctor
There was a problem hiding this comment.
udpated the toString() - when it calls errFmt those functions handle null so no need to check there, they will print null.
removed code duplication by moving the null check into the super class, there are only 2 direct subclasses that need to worry about the checkNulls param
| private final List<ColumnMetadataPredicate> strictMatch; | ||
|
|
||
| // A def that represents the rules used by the old `CollectionTableMatcher` | ||
| private static final SuperShreddingBinding BACKWARDS_COMPAT = |
There was a problem hiding this comment.
SuperShreddingBinding.builder().build()
It seems you are putting all default builder values, now i would understand you want to make them explicitely visible at this level
There was a problem hiding this comment.
not sure if this is a half finished comment.
The BackwardsCompat is there to capture past behaviour for the no param ctor to use for backwards compat.
So the new builder code to create the Predicate is only used by tests, until we start changing the tests. Such as also tests for indexes.
The goal in this PR was to change implementation, but leave behaviour the same.
| * | ||
| * <p>This class used to be called <code>CollectionTableMatcher</code> | ||
| * | ||
| * <p><b>NOTE:</b> As of June 2026, there is no check the indexes are valid, this will be future |
There was a problem hiding this comment.
Got it, but let me see if i can create a baby index validator after the column valudation in SchemaObjectFactory
There was a problem hiding this comment.
The predicate checks columns but not indexes. A collection with correct columns but missing/broken SAI indexes passes the predicate and is treated as healthy -- downstream queries then fail with confusing CQL errors.
I've prototyped a SuperShreddingIndexValidator on branch clun/review-2499-index-validator:
SuperShreddingIndexValidator-- validates SAI indexes after the predicate passes, returns aValidationResultwith missing/present/unexpected indexesSuperShreddingIndexValidatorTest-- 13 tests covering healthy tables, missing required/optional indexes, unexpected indexes, and warn loggingTableMetadataTestUtiladditions --removeIndex,removeAllIndexes,clearAllIndexes,addIndexSchemaObjectFactorysketch -- shows where to wirevalidate()afterIS_COLLECTION_PREDICATE.test()(old code kept as comment)
Branch: clun/review-2499-index-validator (based on this PR's branch)
There was a problem hiding this comment.
thanks, will have a look after we get this one in. For this PR I wanted to keep the logic of the predicate the same but change implementation - so all previously passed tests keep passing.
Future work can expand the logic in the predicate
What this PR does:
Refactor the ColectionTableMatcher into the SuperShreddingTablePredicate , and create a standard way to define what is in a SuperShredding table, via the SuperShreddingBuilder. We can then use this builder to create different components we need, such as predciate and cql statements to create the table.
This PR sets a foundation by putting the definition of super shredding in one place, and building a way to test / verify we are creating CQL we expect. With the idea that above that low level CQL testing verification we run tests against the tableMetadata etc.
This PR only updates the table matcher, next PR's will update how CreateCollectionOperation and related classes work to make a super shredding table.
Checklist