Skip to content

Commit

Permalink
AVRO-3779: [Rust] Fully specify the dependency to bigdecimal crate (#…
Browse files Browse the repository at this point in the history
…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 <[email protected]>
  • Loading branch information
martin-g authored Nov 22, 2023
1 parent b4968f7 commit c23c68b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
4 changes: 2 additions & 2 deletions lang/rust/Cargo.lock

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

2 changes: 1 addition & 1 deletion lang/rust/avro/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }
Expand All @@ -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" }
Expand Down
11 changes: 5 additions & 6 deletions lang/rust/avro/src/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5155,24 +5155,23 @@ 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!(
parse_result.is_ok(),
"parse result must be ok, got: {:?}",
parse_result
);
match parse_result? {
Schema::BigDecimal => (),
other => panic!("Expected Schema::BigDecimal but got: {other:?}"),
}

Ok(())
}
Expand Down

0 comments on commit c23c68b

Please sign in to comment.