-
Notifications
You must be signed in to change notification settings - Fork 111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CQL Vector support #1165
Open
smoczy123
wants to merge
6
commits into
scylladb:main
Choose a base branch
from
smoczy123:vector-type
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
CQL Vector support #1165
Changes from 1 commit
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
08c322d
frame: added a parser for Java-class type names
smoczy123 89f6109
frame: added a Vector CqlValue and ColumnType
smoczy123 2a158c6
types/deserialize: added vector deserialization
smoczy123 3d80583
types/serialize: added vector serialization
smoczy123 cf57346
test: added tests for vector type
smoczy123 440d63a
docs: added docs for vector type
smoczy123 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3169,6 +3169,8 @@ async fn test_vector_type_metadata() { | |
#[cfg(cassandra_tests)] | ||
#[tokio::test] | ||
async fn test_vector_type_unprepared() { | ||
use std::vec; | ||
|
||
Comment on lines
+3172
to
+3173
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ❓ ♻️ Is this used anywhere? |
||
setup_tracing(); | ||
let session = create_new_session_builder().build().await.unwrap(); | ||
let ks = unique_keyspace_name(); | ||
|
@@ -3186,16 +3188,32 @@ async fn test_vector_type_unprepared() { | |
|
||
session | ||
.query_unpaged( | ||
format!( | ||
"INSERT INTO {}.t (a, b, c) VALUES (1, [1, 2, 3, 4], ['foo', 'bar'])", | ||
ks | ||
), | ||
&[], | ||
format!("INSERT INTO {}.t (a, b, c) VALUES (?, ?, ?)", ks), | ||
&(1, vec![1, 2, 3, 4], vec!["foo", "bar"]), | ||
) | ||
.await | ||
.unwrap(); | ||
|
||
// TODO: Implement and test SELECT statements and bind values (`?`) | ||
let query_result = session | ||
.query_unpaged(format!("SELECT * FROM {}.t", ks), &[]) | ||
.await | ||
.unwrap(); | ||
|
||
let rows: Vec<(i32, Vec<i32>, Vec<String>)> = query_result | ||
.into_rows_result() | ||
.unwrap() | ||
.rows::<(i32, Vec<i32>, Vec<String>)>() | ||
.unwrap() | ||
.map(|r| r.unwrap()) | ||
.collect(); | ||
assert_eq!( | ||
rows[0], | ||
( | ||
1, | ||
vec![1, 2, 3, 4], | ||
vec!["foo".to_string(), "bar".to_string()] | ||
) | ||
); | ||
} | ||
|
||
#[cfg(cassandra_tests)] | ||
|
@@ -3217,16 +3235,35 @@ async fn test_vector_type_prepared() { | |
.unwrap(); | ||
|
||
let prepared_statement = session | ||
.prepare(format!( | ||
"INSERT INTO {}.t (a, b, c) VALUES (?, [11, 12, 13, 14], ['afoo', 'abar'])", | ||
ks | ||
)) | ||
.prepare(format!("INSERT INTO {}.t (a, b, c) VALUES (?, ?, ?)", ks)) | ||
.await | ||
.unwrap(); | ||
session | ||
.execute_unpaged(&prepared_statement, &(2,)) | ||
.execute_unpaged( | ||
&prepared_statement, | ||
&(2, vec![11, 12, 13, 14], vec!["afoo", "abar"]), | ||
) | ||
.await | ||
.unwrap(); | ||
|
||
let query_result = session | ||
.query_unpaged(format!("SELECT * FROM {}.t", ks), &[]) | ||
.await | ||
.unwrap(); | ||
|
||
// TODO: Implement and test SELECT statements and bind values (`?`) | ||
let rows: Vec<(i32, Vec<i32>, Vec<String>)> = query_result | ||
.into_rows_result() | ||
.unwrap() | ||
.rows::<(i32, Vec<i32>, Vec<String>)>() | ||
.unwrap() | ||
.map(|r| r.unwrap()) | ||
.collect(); | ||
assert_eq!( | ||
rows[0], | ||
( | ||
2, | ||
vec![11, 12, 13, 14], | ||
vec!["afoo".to_string(), "abar".to_string()] | ||
) | ||
); | ||
} |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You introduced a beast of a module (
type_parser
) which is capable of parsing the syntax of any type (be it a primitive type, list, UDT, vector, etc...), but you added only this one, short test. Please add more tests for that module (preferably in the commit which introduced it) in order to increase the coverage.