Uh oh!
There was an error while loading. Please reload this page.
fix: correct 'clustering_key' to 'clustering' in column kind filter - #761
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.
Uh oh!
There was an error while loading. Please reload this page.
mykaul
commented
Mar 26, 2026
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 :-/ |
mykaul
commented
Mar 26, 2026
AI again: |
Uh oh!
There was an error while loading. Please reload this page.
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).