-
Notifications
You must be signed in to change notification settings - Fork 156
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
test(414): multi-column index scan #415
Conversation
be8cace
to
fa67322
Compare
@@ -1920,20 +1915,20 @@ impl TxDatastore for Locking { | |||
&'a self, | |||
tx: &'a Self::TxId, | |||
table_id: TableId, | |||
col_id: ColId, | |||
cols: NonEmpty<ColId>, |
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.
Updated the datastore iterators to take a NonEmpty list of column ids.
@@ -152,7 +152,7 @@ impl InstanceEnv { | |||
let eq_value = stdb.decode_column(tx, table_id, col_id, value)?; | |||
|
|||
// Find all rows in the table where the column data equates to `value`. | |||
let seek = stdb.iter_by_col_eq(tx, table_id, col_id, eq_value)?; | |||
let seek = stdb.iter_by_col_eq(tx, table_id, ColId(col_id), eq_value)?; |
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.
After updating the type signatures of the datastore iterators, the rest of the changes, like this one, were about updating the call sites to reflect the new signature.
let cols: NonEmpty<ColId> = NonEmpty::collect(vec![ColId(0), ColId(1)]).unwrap(); | ||
let value: AlgebraicValue = product![AlgebraicValue::U64(0), AlgebraicValue::U64(1)].into(); | ||
|
||
let IterByColEq::Index(mut iter) = stdb.iter_by_col_eq(&tx, table_id, cols, value)? else { |
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.
Testing the new iter_by_col_eq
with multi-column index.
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.
👍
//If we don't have `self.tx_state` yet is likely we are running the bootstrap process | ||
Some(committed_rows) => match self.tx_state.as_ref() { | ||
None => Ok(IterByColRange::Scan(ScanIterByColRange { | ||
range, | ||
col_id: *col_id, | ||
cols: NonEmpty::collect(cols.into_iter().map(|col| col.0)).unwrap(), |
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.
I think you can just map directly over cols
fa67322
to
0dbcf1f
Compare
Closes #414. Adds a test for calling iter_by_col_eq with multiple columns. Ensures the index is scanned if an applicable multi-column index is present. To write this test, iter_by_col_eq was updated to take multiple columns.
0dbcf1f
to
7c84ba8
Compare
Closes #414.
Adds a test for calling iter_by_col_eq with multiple columns. Ensures the index is scanned if an applicable multi-column index is present. To write this test, iter_by_col_eq was updated to take multiple columns.
Description of Changes
API and ABI
If the API is breaking, please state below what will break
Expected complexity level and risk
How complicated do you think these changes are? Grade on a scale from 1 to 5,
where 1 is a trivial change, and 5 is a deep-reaching and complex change.
This complexity rating applies not only to the complexity apparent in the diff,
but also to its interactions with existing and future code.
If you answered more than a 2, explain what is complex about the PR,
and what other components it interacts with in potentially concerning ways.