You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@avro.apache.org by mg...@apache.org on 2023/05/09 19:06:00 UTC
[avro] 01/01: AVRO-3752: [Rust] Logging flood during Union resolving
This is an automated email from the ASF dual-hosted git repository.
mgrigorov pushed a commit to branch avro-3752-test-case-excessive-logging
in repository https://gitbox.apache.org/repos/asf/avro.git
commit 97970d043d49c073e8e94f7e6e96b72e86ead5e7
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
AuthorDate: Tue May 9 22:04:48 2023 +0300
AVRO-3752: [Rust] Logging flood during Union resolving
Add the test case from the ticket.
It does not log any errors
Signed-off-by: Martin Tzvetanov Grigorov <mg...@apache.org>
---
lang/rust/avro/src/types.rs | 34 ++++++++++++++++++++++++++++++++++
1 file changed, 34 insertions(+)
diff --git a/lang/rust/avro/src/types.rs b/lang/rust/avro/src/types.rs
index ee322b331..b94dc17bf 100644
--- a/lang/rust/avro/src/types.rs
+++ b/lang/rust/avro/src/types.rs
@@ -2638,4 +2638,38 @@ Field with name '"b"' is not a member of the map items"#,
fn test_avro_3688_field_b_set() {
avro_3688_schema_resolution_panic(true);
}
+
+ #[test]
+ fn avro_3752_logging_test() -> anyhow::Result<()> {
+ // we'll match string against this schema, as you can see it's the last variant.
+ let raw_schema = r#"{
+ "type": "record",
+ "name": "root",
+ "fields": [
+ {
+ "name": "union",
+ "type": [
+ "null",
+ "int",
+ "boolean",
+ {
+ "type": "enum",
+ "symbols": ["A"],
+ "name": "enum"
+ }
+ ]
+ }
+ ]
+ }"#;
+ let schema = Schema::parse_str(raw_schema)?;
+ // dbg!(&schema);
+ let avro_value = Value::Record(vec![(
+ "union".to_string(),
+ Value::Union(3, Box::new(Value::Enum(0, "A".to_string()))),
+ )]);
+ // dbg!(&avro_value);
+ let resolved = avro_value.resolve(&schema)?;
+ dbg!(resolved);
+ Ok(())
+ }
}