Skip to content

Commit

Permalink
query_params: add skip_metadata flag
Browse files Browse the repository at this point in the history
  • Loading branch information
muzarski committed Feb 14, 2024
1 parent 1e956f8 commit 221ec17
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions scylla-cql/benches/benchmark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ fn make_query(contents: &str, values: SerializedValues) -> query::Query<'_> {
consistency: scylla_cql::Consistency::LocalQuorum,
serial_consistency: None,
values: Cow::Owned(values),
skip_metadata: false,
page_size: None,
paging_state: None,
timestamp: None,
Expand Down
3 changes: 3 additions & 0 deletions scylla-cql/src/frame/request/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ mod tests {
timestamp: None,
page_size: Some(323),
paging_state: Some(vec![2, 1, 3, 7].into()),
skip_metadata: false,
values: {
let mut vals = SerializedValues::new();
vals.add_value(&2137, &ColumnType::Int).unwrap();
Expand Down Expand Up @@ -156,6 +157,7 @@ mod tests {
timestamp: Some(3423434),
page_size: None,
paging_state: None,
skip_metadata: false,
values: {
let mut vals = SerializedValues::new();
vals.add_value(&42, &ColumnType::Int).unwrap();
Expand Down Expand Up @@ -213,6 +215,7 @@ mod tests {
timestamp: None,
page_size: None,
paging_state: None,
skip_metadata: false,
values: Cow::Borrowed(SerializedValues::EMPTY),
};
let query = Query {
Expand Down
8 changes: 8 additions & 0 deletions scylla-cql/src/frame/request/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ pub struct QueryParameters<'a> {
pub timestamp: Option<i64>,
pub page_size: Option<i32>,
pub paging_state: Option<Bytes>,
pub skip_metadata: bool,
pub values: Cow<'a, SerializedValues>,
}

Expand All @@ -74,6 +75,7 @@ impl Default for QueryParameters<'_> {
timestamp: None,
page_size: None,
paging_state: None,
skip_metadata: false,
values: Cow::Borrowed(SerializedValues::EMPTY),
}
}
Expand All @@ -88,6 +90,10 @@ impl QueryParameters<'_> {
flags |= FLAG_VALUES;
}

if self.skip_metadata {
flags |= FLAG_SKIP_METADATA;
}

if self.page_size.is_some() {
flags |= FLAG_PAGE_SIZE;
}
Expand Down Expand Up @@ -143,6 +149,7 @@ impl<'q> QueryParameters<'q> {
)));
}
let values_flag = (flags & FLAG_VALUES) != 0;
let skip_metadata = (flags & FLAG_SKIP_METADATA) != 0;
let page_size_flag = (flags & FLAG_PAGE_SIZE) != 0;
let paging_state_flag = (flags & FLAG_WITH_PAGING_STATE) != 0;
let serial_consistency_flag = (flags & FLAG_WITH_SERIAL_CONSISTENCY) != 0;
Expand Down Expand Up @@ -192,6 +199,7 @@ impl<'q> QueryParameters<'q> {
timestamp,
page_size,
paging_state,
skip_metadata,
values,
})
}
Expand Down
2 changes: 2 additions & 0 deletions scylla/src/transport/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -655,6 +655,7 @@ impl Connection {
values: Cow::Borrowed(SerializedValues::EMPTY),
page_size: query.get_page_size(),
paging_state,
skip_metadata: false,
timestamp: query.get_timestamp(),
},
};
Expand Down Expand Up @@ -699,6 +700,7 @@ impl Connection {
values: Cow::Borrowed(values),
page_size: prepared_statement.get_page_size(),
timestamp: prepared_statement.get_timestamp(),
skip_metadata: prepared_statement.get_use_cached_result_metadata(),
paging_state,
},
};
Expand Down

0 comments on commit 221ec17

Please sign in to comment.