DRAFT - Refactor Collection Table Matcher#2499
Conversation
…-backward-compatibility
…-backward-compatibility
makes CreateCollectionBackwardCompatibilityIntegrationTest work
code tidy, remove code duplication, and for test
|
|
||
| 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
| this.textIndexTag |= other.textIndexTag; | ||
| this.timestampIndexTag |= other.timestampIndexTag; | ||
| this.nullIndexTag |= other.nullIndexTag; | ||
| this.vectorIndexTag |= other.vectorIndexTag; |
There was a problem hiding this comment.
I think we are missing the lexicalIndexTag, adding a line 68
this.vectorIndexTag |= other.vectorIndexTag;
this.lexicalIndexTag |= other.lexicalIndexTag;| * <p>This pulls the options from the {@link SuperShreddingBinding} and puts them into maps of the | ||
| * values each index definition needs | ||
| */ | ||
| protected Stream<IndexDef> indexDefs(SuperShreddingBinding binding) { |
There was a problem hiding this comment.
The parameter binding is unused, i think there is no need to introduce the parameter except if you want to override the internal one which would be a mutation different for the rest of the class => delete.
| 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
| 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
| * | ||
| * <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)
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