Skip to content

Commit 44c4b2a

Browse files
sunng87joshua-spacetimebfops
authored
feat: update pgwire to 0.37 (#3910)
# Description of Changes Update pgwire to 0.37 Make `DataRowEncoder` reusable as enabled in this release, make introduce 3x performance on encoding. # API and ABI breaking changes N/A # Expected complexity level and risk N/A # Testing <!-- Describe any testing you've done, and any testing you'd like your reviewers to do, so that you're confident that all the changes work as expected! --> - [ ] <!-- maybe a test you want to do --> - [ ] <!-- maybe a test you want a reviewer to do, so they can check it off when they're satisfied. --> --------- Signed-off-by: Ning Sun <sunning@greptime.com> Signed-off-by: joshua-spacetime <josh@clockworklabs.io> Co-authored-by: joshua-spacetime <josh@clockworklabs.io> Co-authored-by: Zeke Foppa <196249+bfops@users.noreply.github.com>
1 parent 5c7d7e7 commit 44c4b2a

4 files changed

Lines changed: 18 additions & 7 deletions

File tree

Cargo.lock

Lines changed: 14 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ paste = "1.0"
245245
percent-encoding = "2.3"
246246
petgraph = { version = "0.6.5", default-features = false }
247247
pin-project-lite = "0.2.9"
248-
pgwire = { version = "0.34.2", default-features = false, features = ["server-api", "pg-ext-types"] }
248+
pgwire = { version = "0.37", default-features = false, features = ["server-api", "pg-ext-types"] }
249249
postgres-types = "0.2.5"
250250
pretty_assertions = { version = "1.4", features = ["unstable"] }
251251
proc-macro2 = "1.0"

crates/pg/src/encoder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ pub(crate) fn type_of(schema: &ProductType, ty: &ProductTypeElement) -> Type {
5757
_ => Type::ANYARRAY,
5858
},
5959
AlgebraicType::Product(_) => match format {
60-
PsqlPrintFmt::Hex => Type::BYTEA_ARRAY,
60+
PsqlPrintFmt::Hex => Type::BYTEA,
6161
PsqlPrintFmt::Timestamp => Type::TIMESTAMP,
6262
PsqlPrintFmt::Duration => Type::INTERVAL,
6363
PsqlPrintFmt::Uuid => Type::UUID,

crates/pg/src/pg_server.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,8 @@ pub(crate) fn to_rows(
7373
let mut results = Vec::with_capacity(stmt.rows.len());
7474
let ty = Typespace::EMPTY.with_type(&stmt.schema);
7575

76+
let mut encoder = DataRowEncoder::new(header.clone());
7677
for row in stmt.rows {
77-
let mut encoder = DataRowEncoder::new(header.clone());
78-
7978
for (idx, value) in ty.with_values(&row).enumerate() {
8079
let ty = satn::PsqlType {
8180
client: PsqlClient::Postgres,
@@ -86,7 +85,7 @@ pub(crate) fn to_rows(
8685
let mut fmt = PsqlFormatter { encoder: &mut encoder };
8786
value.serialize(TypedSerializer { ty: &ty, f: &mut fmt })?;
8887
}
89-
results.push(encoder.finish());
88+
results.push(Ok(encoder.take_row()));
9089
}
9190
Ok(stream::iter(results))
9291
}

0 commit comments

Comments
 (0)