From 35ea7170eaf554efd2894db30098b6aa4c788602 Mon Sep 17 00:00:00 2001 From: ZENOTME Date: Wed, 19 Jun 2024 13:33:53 +0800 Subject: [PATCH 1/2] use upstream avro --- Cargo.toml | 2 +- icelake/src/types/to_avro.rs | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index d8bdafc..bfdda67 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,7 +11,7 @@ resolver = "2" anyhow = "1" async-trait = "0.1" # branch is icelake-dev -apache-avro = { git = "https://github.com/icelake-io/avro.git", branch = "icelake-dev", recv = "4b828e9283e7248fd3ca42f5b590c2160b201785",features = ["derive"] } +apache-avro = { git = "https://github.com/apache/avro.git", recv = "fdab5db0816e28e3e10c87910c8b6f98c33072dc",features = ["derive"] } arrow-array = { version = ">=50" } arrow-schema = { version = ">=50" } arrow-select = { version = ">=50" } diff --git a/icelake/src/types/to_avro.rs b/icelake/src/types/to_avro.rs index 0bc616c..61000ce 100644 --- a/icelake/src/types/to_avro.rs +++ b/icelake/src/types/to_avro.rs @@ -129,6 +129,7 @@ impl<'a, 'b> TryFrom> for AvroSchema { doc: None, size: Primitive::decimal_required_bytes(*precision as u32)? as usize, attributes: BTreeMap::default(), + default: None, })), }), Primitive::Date => AvroSchema::Date, @@ -161,7 +162,7 @@ impl<'a, 'b> TryFrom> for AvroSchema { AvroSchema::Map(AvroMapSchema { types: Box::new(value_avro_schema), - custom_attributes: BTreeMap::from([ + attributes: BTreeMap::from([ ( KEY_ID.to_string(), JsonValue::String(map.key_id.to_string()), @@ -207,7 +208,7 @@ impl<'a, 'b> TryFrom> for AvroSchema { format!("k{}_v{}", map.key_id, map.value_id).as_str(), vec![key_field, value_field], ))), - custom_attributes: BTreeMap::from([( + attributes: BTreeMap::from([( LOGICAL_TYPE.to_string(), JsonValue::String("map".to_string()), )]), @@ -224,7 +225,7 @@ impl<'a, 'b> TryFrom> for AvroSchema { } AvroSchema::Array(AvroArraySchema { items: Box::new(avro_schema), - custom_attributes: BTreeMap::from([( + attributes: BTreeMap::from([( ELEMENT_ID.to_string(), list.element_id.into(), )]), From 102d36b2c29e9e3d1ae24c24a728bb5b00756351 Mon Sep 17 00:00:00 2001 From: ZENOTME Date: Wed, 19 Jun 2024 13:37:54 +0800 Subject: [PATCH 2/2] fix format --- icelake/src/types/to_avro.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/icelake/src/types/to_avro.rs b/icelake/src/types/to_avro.rs index 61000ce..ef85143 100644 --- a/icelake/src/types/to_avro.rs +++ b/icelake/src/types/to_avro.rs @@ -225,10 +225,7 @@ impl<'a, 'b> TryFrom> for AvroSchema { } AvroSchema::Array(AvroArraySchema { items: Box::new(avro_schema), - attributes: BTreeMap::from([( - ELEMENT_ID.to_string(), - list.element_id.into(), - )]), + attributes: BTreeMap::from([(ELEMENT_ID.to_string(), list.element_id.into())]), }) } Any::Struct(s) => {