fix: correct 'clustering_key' to 'clustering' in column kind filter#761
Open
mykaul wants to merge 1 commit intoscylladb:masterfrom
Open
fix: correct 'clustering_key' to 'clustering' in column kind filter#761mykaul wants to merge 1 commit intoscylladb:masterfrom
mykaul wants to merge 1 commit intoscylladb:masterfrom
Conversation
The column kind filter at line 2744 used 'clustering_key' but system_schema.columns uses 'clustering' as the kind value. This caused clustering columns to not be excluded from the 'other columns' loop, resulting in them being processed twice (once as clustering key, once as regular column). The correct value 'clustering' was already used 6 lines above in the clustering key extraction loop.
There was a problem hiding this comment.
Pull request overview
Fixes a schema parsing bug in SchemaParserV3._build_table_columns() where clustering columns from system_schema.columns were not being filtered out of the “other columns” loop due to using the wrong kind value.
Changes:
- Corrected the
kindfilter from'clustering_key'to'clustering'when skipping key columns during non-key column processing.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Author
|
It's not very clear to me it is the correct fix. In GoCQL we have both? https://github.com/scylladb/gocql/blob/2d8532c6f9e6047ef4c05e5705224dd618d76387/metadata_scylla.go#L509 AI says:
I think AI is wrong here. Nothing is sent over the write as such. Need to understand this and GoCQL better :-/ |
Author
|
AI again: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
SchemaParserV3._build_table_metadata()where the column kind filter atcassandra/metadata.py:2744used'clustering_key'instead of'clustering', causing clustering columns to not be excluded from the "other columns" loop and thus processed/added twice.Details
The
system_schema.columnstable uses'clustering'as thekindvalue for clustering key columns (not'clustering_key'). The correct value'clustering'is already used 6 lines above (line 2735) when building the clustering key list. The filter on line 2744, which is supposed to skip partition key and clustering columns when iterating "other" columns, was using the wrong string.This bug is harmless in most cases because
_build_column_metadata()overwrites column objects in a dict, but it causes unnecessary duplicate processing and could cause subtle issues with column ordering in edge cases.Testing
All 55 metadata unit tests pass (
tests/unit/test_metadata.py). The 1 pre-existing test failure intests/unit/test_types.py::TypeTests::test_lookup_casstypeis unrelated (broken test onmaster, to be fixed by PR #690).