From c23c68bd4bfa2f34c9053d93c2160fe3dd6f7f23 Mon Sep 17 00:00:00 2001 From: Martin Grigorov Date: Wed, 22 Nov 2023 09:19:18 +0200 Subject: [PATCH] AVRO-3779: [Rust] Fully specify the dependency to bigdecimal crate (#2595) AVRO-3779: Simplify the schema to test only BigDecimal Depend on full version and enable only the `std` feature Signed-off-by: Martin Tzvetanov Grigorov --- lang/rust/Cargo.lock | 4 ++-- lang/rust/avro/Cargo.toml | 2 +- lang/rust/avro/src/schema.rs | 11 +++++------ 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/lang/rust/Cargo.lock b/lang/rust/Cargo.lock index d585c8fb403..b50a6383c84 100644 --- a/lang/rust/Cargo.lock +++ b/lang/rust/Cargo.lock @@ -158,9 +158,9 @@ dependencies = [ [[package]] name = "bigdecimal" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "454bca3db10617b88b566f205ed190aedb0e0e6dd4cad61d3988a72e8c5594cb" +checksum = "c06619be423ea5bb86c95f087d5707942791a08a85530df0db2209a3ecfb8bc9" dependencies = [ "autocfg", "libm", diff --git a/lang/rust/avro/Cargo.toml b/lang/rust/avro/Cargo.toml index b9610a8b544..60cf9da41b1 100644 --- a/lang/rust/avro/Cargo.toml +++ b/lang/rust/avro/Cargo.toml @@ -55,6 +55,7 @@ name = "single" [dependencies] apache-avro-derive = { default-features = false, version = "0.17.0", path = "../avro_derive", optional = true } +bigdecimal = { default-features = false, version = "0.4.2", features = ["std"] } bzip2 = { default-features = false, version = "0.4.4", optional = true } crc32fast = { default-features = false, version = "1.3.2", optional = true } digest = { default-features = false, version = "0.10.7", features = ["core-api"] } @@ -73,7 +74,6 @@ typed-builder = { default-features = false, version = "0.16.2" } uuid = { default-features = false, version = "1.4.1", features = ["serde", "std"] } xz2 = { default-features = false, version = "0.1.7", optional = true } zstd = { default-features = false, version = "0.12.4+zstd.1.5.2", optional = true } -bigdecimal = "0.4" [target.'cfg(target_arch = "wasm32")'.dependencies] quad-rand = { default-features = false, version = "0.2.1" } diff --git a/lang/rust/avro/src/schema.rs b/lang/rust/avro/src/schema.rs index bc371b5e00b..f2487e316f4 100644 --- a/lang/rust/avro/src/schema.rs +++ b/lang/rust/avro/src/schema.rs @@ -5155,17 +5155,12 @@ mod tests { #[test] fn test_avro_3779_bigdecimal_schema() -> TestResult { let schema = json!( - { - "type": "record", - "name": "recordWithDecimal", - "fields": [ { "name": "decimal", "type": "bytes", "logicalType": "big-decimal" } - ] - }); + ); let parse_result = Schema::parse(&schema); assert!( @@ -5173,6 +5168,10 @@ mod tests { "parse result must be ok, got: {:?}", parse_result ); + match parse_result? { + Schema::BigDecimal => (), + other => panic!("Expected Schema::BigDecimal but got: {other:?}"), + } Ok(()) }