Fix vector type formatting error in cqlsh#165
Merged
fruch merged 1 commit intoscylladb:masterfrom Mar 12, 2026
Merged
Conversation
CqlType.parse() treated vector<float, 5> as having two subtypes [float, 5]. When formatting a 5-element vector, get_n_sub_types(5) failed because len(sub_types) == 2 matched neither the tuple case (== num) nor the list/set case (== 1), raising: 'Unexpected number of subtypes 5 - [float, 5]' Fix: when parsing a vector<type, dimension> type string, discard the dimension and keep only the element type as a single subtype. This lets get_n_sub_types() replicate the element type for each value in the vector, matching the existing list/set code path. Added test_vector_formatting.py with 8 tests covering CqlType parsing and end-to-end value formatting for various vector types. Fixes: VECTOR-563
Contributor
Author
|
Failing test is known issue: #164 |
Collaborator
|
@swasik now you can pull it in scylla code, and get it updated there |
Contributor
Author
What exactly should I do? It's the first time I contribute to cqlsh. |
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.
CqlType.parse() treated vector<float, 5> as having two subtypes [float, 5]. When formatting a 5-element vector, get_n_sub_types(5) failed because len(sub_types) == 2 matched neither the tuple case (== num) nor the list/set case (== 1), raising:
'Unexpected number of subtypes 5 - [float, 5]'
Fix: when parsing a vector<type, dimension> type string, discard the dimension and keep only the element type as a single subtype. This lets get_n_sub_types() replicate the element type for each value in the vector, matching the existing list/set code path.
Added test_vector_formatting.py with 8 tests covering CqlType parsing and end-to-end value formatting for various vector types.
Fixes: VECTOR-563