Skip to content

adapter: remove unreachable code in statement_logging, for peek results #32388

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 2 additions & 22 deletions src/adapter/src/statement_logging.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,18 +150,8 @@ impl From<&ExecuteResponse> for StatementEndedExecutionReason {
fn from(value: &ExecuteResponse) -> StatementEndedExecutionReason {
match value {
ExecuteResponse::CopyTo { resp, .. } => match resp.as_ref() {
// NB [btv]: It's not clear that this combination
// can ever actually happen.
ExecuteResponse::SendingRowsImmediate { rows, .. } => {
// Note(parkmycar): It potentially feels bad here to iterate over the entire
// iterator _just_ to get the encoded result size. As noted above, it's not
// entirely clear this case ever happens, so the simplicity is worth it.
let result_size: usize = rows.box_clone().map(|row| row.byte_len()).sum();
StatementEndedExecutionReason::Success {
result_size: Some(u64::cast_from(result_size)),
rows_returned: Some(u64::cast_from(rows.count())),
execution_strategy: Some(StatementExecutionStrategy::Constant),
}
panic!("SELECTs terminate on peek finalization, not here.")
}
ExecuteResponse::SendingRows { .. } => {
panic!("SELECTs terminate on peek finalization, not here.")
Expand All @@ -185,17 +175,7 @@ impl From<&ExecuteResponse> for StatementEndedExecutionReason {
}

ExecuteResponse::SendingRowsImmediate { rows, .. } => {
// Note(parkmycar): It potentially feels bad here to iterate over the entire
// iterator _just_ to get the encoded result size, the number of Rows returned here
// shouldn't be too large though. An alternative is to pre-compute some of the
// result size, but that would require always decoding Rows to handle projecting
// away columns, which has a negative impact for much larger response sizes.
let result_size: usize = rows.box_clone().map(|row| row.byte_len()).sum();
StatementEndedExecutionReason::Success {
result_size: Some(u64::cast_from(result_size)),
rows_returned: Some(u64::cast_from(rows.count())),
execution_strategy: Some(StatementExecutionStrategy::Constant),
}
panic!("SELECTs terminate on peek finalization, not here.")
}

ExecuteResponse::AlteredDefaultPrivileges
Expand Down