Skip to content

Commit

Permalink
interchange,testdrive: unfork serde-protobuf
Browse files Browse the repository at this point in the history
We forked serde-protobuf library to add one method to improve an error
message.  Empirically we have not been keeping up with maintenance of
our fork, so it's time to ditch the fork.

This commit swaps our fork for the latest official serde-protobuf
release. I left a TODO to restore the error message improvement if the
patch [0] from our fork is accepted upstream.

Notably, this commit removes the last usage of failure from our
codebase.

[0]: dflemstr/serde-protobuf#9
  • Loading branch information
benesch committed Aug 22, 2021
1 parent 35c004b commit a1d9f7f
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 37 deletions.
33 changes: 6 additions & 27 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion deny.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ allow-git = [
"https://github.com/MaterializeInc/rust-postgres.git",
"https://github.com/MaterializeInc/rust-postgres-array.git",
"https://github.com/MaterializeInc/rust-prometheus.git",
"https://github.com/MaterializeInc/serde-protobuf.git",
"https://github.com/TimelyDataflow/timely-dataflow",
"https://github.com/TimelyDataflow/differential-dataflow.git",
"https://github.com/fede1024/rust-rdkafka.git",
Expand Down
2 changes: 1 addition & 1 deletion src/interchange/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ ore = { path = "../ore" }
protobuf = "2.23.0"
repr = { path = "../repr" }
serde = { version = "1.0.127", features = ["derive"] }
serde-protobuf = { git = "https://github.com/MaterializeInc/serde-protobuf.git", branch = "add-iter-messages" }
serde-protobuf = "0.8.2"
serde-value = "0.7.0"
serde_json = "1.0.66"
sha2 = "0.9.5"
Expand Down
16 changes: 9 additions & 7 deletions src/interchange/src/protobuf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ use serde_protobuf::descriptor::{
use serde_protobuf::value::Value as ProtoValue;
use serde_value::Value as SerdeValue;

use ore::str::StrExt;
use repr::adt::numeric::Numeric;
use repr::{ColumnType, Datum, DatumList, RelationDesc, RelationType, Row, ScalarType};

Expand Down Expand Up @@ -133,14 +134,15 @@ pub fn decode_descriptors(descriptors: &[u8]) -> Result<Descriptors> {
pub fn validate_descriptors(message_name: &str, descriptors: &Descriptors) -> Result<RelationDesc> {
let proto_name = proto_message_name(message_name);
let message = descriptors.message_by_name(&proto_name).ok_or_else(|| {
// TODO(benesch): the error message here used to include the names of
// all messages in the descriptor set, but that one feature required
// maintaining a fork of serde_protobuf. I sent the patch upstream [0],
// and we can add the error message improvement back if that patch is
// accepted.
// [0]: https://github.com/dflemstr/serde-protobuf/pull/9
anyhow!(
"Message {:?} not found in file descriptor set: {}",
proto_name,
descriptors
.iter_messages()
.map(|m| m.name())
.collect::<Vec<_>>()
.join(", ")
"Message {} not found in file descriptor set",
proto_name.quoted()
)
})?;
let mut seen_messages = HashSet::new();
Expand Down
2 changes: 1 addition & 1 deletion src/testdrive/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ rusoto_s3 = "0.47.0"
rusoto_sqs = "0.47.0"
rusoto_sts = "0.47.0"
serde = "1.0.127"
serde-protobuf = { git = "https://github.com/MaterializeInc/serde-protobuf.git", branch = "add-iter-messages" }
serde-protobuf = "0.8.2"
serde_json = "1.0.66"
sql-parser = { path = "../sql-parser" }
structopt = "0.3.22"
Expand Down

0 comments on commit a1d9f7f

Please sign in to comment.