From f04c4f086e5184aeac380caabe990d84a976891c Mon Sep 17 00:00:00 2001 From: ZENOTME <43447882+ZENOTME@users.noreply.github.com> Date: Wed, 19 Jun 2024 17:51:37 +0800 Subject: [PATCH] fix: use upstream avro (#276) Co-authored-by: ZENOTME --- Cargo.toml | 2 +- icelake/src/types/to_avro.rs | 10 ++++------ 2 files changed, 5 insertions(+), 7 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..ef85143 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,10 +225,7 @@ impl<'a, 'b> TryFrom> for AvroSchema { } AvroSchema::Array(AvroArraySchema { items: Box::new(avro_schema), - custom_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) => {