Skip to content

Commit

Permalink
readyset-psql: Switch proxy path to use new PsqlValue FromSql code
Browse files Browse the repository at this point in the history
This should improve proxy efficiency (measurements forthcoming), and
also paves the way for eliminating the last of the unnecessary DfValue
enum index decoding that keeps us from fixing REA-3143.

This diff is a little bit misleading, because the actual change happens
in the ResultsetInner::Stream arm of the match; by moving the conversion
code so that it only applies to the ReadySet arm, the Stream arm infers
that we need Vec<PsqlValue> instead of Vec<DfValue> and switches the
try_get call to use our new FromSql impl on PsqlValue.

Refs: REA-3143
Change-Id: Ie9cc0f7b9124728a5db51de3e20f4580886e19d7
Reviewed-on: https://gerrit.readyset.name/c/readyset/+/5539
Tested-by: Buildkite CI
Reviewed-by: Jason Brown <jason.b@readyset.io>
Reviewed-by: Aspen Smith <aspen@readyset.io>
  • Loading branch information
nickelization committed Jul 25, 2023
1 parent 9646957 commit 396f41c
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions readyset-psql/src/resultset.rs
Expand Up @@ -81,7 +81,13 @@ impl Stream for Resultset {
let project_field_types = self.project_field_types.clone();
let next = match &mut self.get_mut().results {
ResultsetInner::Empty => None,
ResultsetInner::ReadySet(i) => i.next().map(Ok),
ResultsetInner::ReadySet(i) => i.next().map(|values| {
let row = Row {
values,
project_field_types,
};
row.into_iter().map(PsqlValue::try_from).collect()
}),
ResultsetInner::Stream { first_row, stream } => {
let row = match first_row.take() {
Some(row) => Some(Ok(row)),
Expand Down Expand Up @@ -113,13 +119,7 @@ impl Stream for Resultset {
}
};

Poll::Ready(next.map(|values| {
let row = Row {
values: values?,
project_field_types,
};
row.into_iter().map(PsqlValue::try_from).collect()
}))
Poll::Ready(next)
}
}

Expand Down

0 comments on commit 396f41c

Please sign in to comment.