Skip to content

Apache DataFusion SQL Query Engine

chore(deps): update apache-avro requirement from 0.14 to 0.15 (#7174)

jakevin2af3ae77ae46
diff --git a/datafusion-cli/Cargo.lock b/datafusion-cli/Cargo.lock
index 6a95f664ce..5e06b3a341 100644
--- a/datafusion-cli/Cargo.lock
+++ b/datafusion-cli/Cargo.lock
@@ -346,7 +346,7 @@ checksum = "cc6dde6e4ed435a4c1ee4e73592f5ba9da2151af10076cc04858746af9352d09"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.27",
+ "syn 2.0.28",
]
[[package]]
@@ -814,11 +814,12 @@ dependencies = [
[[package]]
name = "cc"
-version = "1.0.79"
+version = "1.0.80"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f"
+checksum = "51f1226cd9da55587234753d1245dd5b132343ea240f26b6a9003d68706141ba"
dependencies = [
"jobserver",
+ "libc",
]
[[package]]
@@ -1029,7 +1030,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1f34ba9a9bcb8645379e9de8cb3ecfcf4d1c85ba66d90deb3259206fa5aa193b"
dependencies = [
"quote",
- "syn 2.0.27",
+ "syn 2.0.28",
]
[[package]]
@@ -1219,6 +1220,12 @@ dependencies = [
"sqlparser",
]
+[[package]]
+name = "deranged"
+version = "0.3.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8810e7e2cf385b1e9b50d68264908ec367ba642c96d02edfe61c39e88e2a3c01"
+
[[package]]
name = "difflib"
version = "0.4.0"
@@ -1325,9 +1332,9 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5"
[[package]]
name = "errno"
-version = "0.3.1"
+version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4bcfec3a70f97c962c307b2d2c56e358cf1d00b558d74262b5f929ee8cc7e73a"
+checksum = "6b30f669a7961ef1631673d2766cc92f52d64f7ef354d4fe0ddfd30ed52f0f4f"
dependencies = [
"errno-dragonfly",
"libc",
@@ -1486,7 +1493,7 @@ checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.27",
+ "syn 2.0.28",
]
[[package]]
@@ -1943,9 +1950,9 @@ dependencies = [
[[package]]
name = "linux-raw-sys"
-version = "0.4.3"
+version = "0.4.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "09fc20d2ca12cb9f044c93e3bd6d32d523e6e2ec3db4f7b2939cd99026ecd3f0"
+checksum = "57bcfdad1b858c2db7c38303a6d2ad4dfaf5eb53dfeb0910128b2c26d6158503"
[[package]]
name = "lock_api"
@@ -2373,7 +2380,7 @@ checksum = "ec2e072ecce94ec471b13398d5402c188e76ac03cf74dd1a975161b23a3f6d9c"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.27",
+ "syn 2.0.28",
]
[[package]]
@@ -2482,9 +2489,9 @@ dependencies = [
[[package]]
name = "quote"
-version = "1.0.31"
+version = "1.0.32"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5fe8a65d69dd0808184ebb5f836ab526bb259db23c657efa38711b1072ee47f0"
+checksum = "50f3b39ccfb720540debaa0164757101c08ecb8d326b15358ce76a62c7e85965"
dependencies = [
"proc-macro2",
]
@@ -2572,9 +2579,9 @@ dependencies = [
[[package]]
name = "regex-automata"
-version = "0.3.3"
+version = "0.3.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "39354c10dd07468c2e73926b23bb9c2caca74c5501e38a35da70406f1d923310"
+checksum = "b7b6d6190b7594385f61bd3911cd1be99dfddcfc365a4160cc2ab5bff4aed294"
dependencies = [
"aho-corasick",
"memchr",
@@ -2744,9 +2751,9 @@ dependencies = [
[[package]]
name = "rustls-webpki"
-version = "0.101.1"
+version = "0.101.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "15f36a6828982f422756984e47912a7a51dcbc2a197aa791158f8ca61cd8204e"
+checksum = "513722fd73ad80a71f72b61009ea1b584bcfa1483ca93949c8f290298837fa59"
dependencies = [
"ring",
"untrusted",
@@ -2858,29 +2865,29 @@ checksum = "a3f0bf26fd526d2a95683cd0f87bf103b8539e2ca1ef48ce002d67aad59aa0b4"
[[package]]
name = "serde"
-version = "1.0.174"
+version = "1.0.180"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3b88756493a5bd5e5395d53baa70b194b05764ab85b59e43e4b8f4e1192fa9b1"
+checksum = "0ea67f183f058fe88a4e3ec6e2788e003840893b91bac4559cabedd00863b3ed"
dependencies = [
"serde_derive",
]
[[package]]
name = "serde_derive"
-version = "1.0.174"
+version = "1.0.180"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6e5c3a298c7f978e53536f95a63bdc4c4a64550582f31a0359a9afda6aede62e"
+checksum = "24e744d7782b686ab3b73267ef05697159cc0e5abbed3f47f9933165e5219036"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.27",
+ "syn 2.0.28",
]
[[package]]
name = "serde_json"
-version = "1.0.103"
+version = "1.0.104"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d03b412469450d4404fe8499a268edd7f8b79fecb074b0d812ad64ca21f4031b"
+checksum = "076066c5f1078eac5b722a31827a8832fe108bed65dfa75e233c89f8206e976c"
dependencies = [
"itoa",
"ryu",
@@ -3052,7 +3059,7 @@ dependencies = [
"proc-macro2",
"quote",
"rustversion",
- "syn 2.0.27",
+ "syn 2.0.28",
]
[[package]]
@@ -3074,9 +3081,9 @@ dependencies = [
[[package]]
name = "syn"
-version = "2.0.27"
+version = "2.0.28"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b60f673f44a8255b9c8c657daf66a596d435f2da81a555b06dc644d080ba45e0"
+checksum = "04361975b3f5e348b2189d8dc55bc942f278b2d482a6a0365de5bdd62d351567"
dependencies = [
"proc-macro2",
"quote",
@@ -3134,7 +3141,7 @@ checksum = "090198534930841fab3a5d1bb637cde49e339654e606195f8d9c76eeb081dc96"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.27",
+ "syn 2.0.28",
]
[[package]]
@@ -3150,10 +3157,11 @@ dependencies = [
[[package]]
name = "time"
-version = "0.3.23"
+version = "0.3.24"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "59e399c068f43a5d116fedaf73b203fa4f9c519f17e2b34f63221d3792f81446"
+checksum = "b79eabcd964882a646b3584543ccabeae7869e9ac32a46f6f22b7a5bd405308b"
dependencies = [
+ "deranged",
"serde",
"time-core",
"time-macros",
@@ -3167,9 +3175,9 @@ checksum = "7300fbefb4dadc1af235a9cef3737cea692a9d97e1b9cbcd4ebdae6f8868e6fb"
[[package]]
name = "time-macros"
-version = "0.2.10"
+version = "0.2.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "96ba15a897f3c86766b757e5ac7221554c6750054d74d5b28844fce5fb36a6c4"
+checksum = "eb71511c991639bb078fd5bf97757e03914361c48100d52878b8e52b46fb92cd"
dependencies = [
"time-core",
]
@@ -3225,7 +3233,7 @@ checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.27",
+ "syn 2.0.28",
]
[[package]]
@@ -3323,7 +3331,7 @@ checksum = "5f4f31f56159e98206da9efd823404b79b6ef3143b4a7ab76e67b1751b25a4ab"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.27",
+ "syn 2.0.28",
]
[[package]]
@@ -3495,7 +3503,7 @@ dependencies = [
"once_cell",
"proc-macro2",
"quote",
- "syn 2.0.27",
+ "syn 2.0.28",
"wasm-bindgen-shared",
]
@@ -3529,7 +3537,7 @@ checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.27",
+ "syn 2.0.28",
"wasm-bindgen-backend",
"wasm-bindgen-shared",
]
diff --git a/datafusion/common/Cargo.toml b/datafusion/common/Cargo.toml
index d7d6146694..4ffe3aa191 100644
--- a/datafusion/common/Cargo.toml
+++ b/datafusion/common/Cargo.toml
@@ -38,7 +38,7 @@ default = []
pyarrow = ["pyo3", "arrow/pyarrow"]
[dependencies]
-apache-avro = { version = "0.14", default-features = false, features = ["snappy"], optional = true }
+apache-avro = { version = "0.15", default-features = false, features = ["snappy"], optional = true }
arrow = { workspace = true }
arrow-array = { workspace = true }
chrono = { version = "0.4", default-features = false }
diff --git a/datafusion/core/Cargo.toml b/datafusion/core/Cargo.toml
index c499c349c0..e641fc97a5 100644
--- a/datafusion/core/Cargo.toml
+++ b/datafusion/core/Cargo.toml
@@ -52,7 +52,7 @@ unicode_expressions = ["datafusion-physical-expr/unicode_expressions", "datafusi
[dependencies]
ahash = { version = "0.8", default-features = false, features = ["runtime-rng"] }
-apache-avro = { version = "0.14", optional = true }
+apache-avro = { version = "0.15", optional = true }
arrow = { workspace = true }
arrow-array = { workspace = true }
arrow-schema = { workspace = true }
diff --git a/datafusion/core/src/datasource/avro_to_arrow/arrow_array_reader.rs b/datafusion/core/src/datasource/avro_to_arrow/arrow_array_reader.rs
index 0d95065697..909227a369 100644
--- a/datafusion/core/src/datasource/avro_to_arrow/arrow_array_reader.rs
+++ b/datafusion/core/src/datasource/avro_to_arrow/arrow_array_reader.rs
@@ -35,6 +35,7 @@ use crate::arrow::error::ArrowError;
use crate::arrow::record_batch::RecordBatch;
use crate::arrow::util::bit_util;
use crate::error::{DataFusionError, Result};
+use apache_avro::schema::RecordSchema;
use apache_avro::{
schema::{Schema as AvroSchema, SchemaKind},
types::Value,
@@ -77,10 +78,10 @@ impl<'a, R: Read> AvroArrowArrayReader<'a, R> {
pub fn schema_lookup(schema: AvroSchema) -> Result<BTreeMap<String, usize>> {
match schema {
- AvroSchema::Record {
+ AvroSchema::Record(RecordSchema {
lookup: ref schema_lookup,
..
- } => Ok(schema_lookup.clone()),
+ }) => Ok(schema_lookup.clone()),
_ => Err(DataFusionError::ArrowError(SchemaError(
"expected avro schema to be a record".to_string(),
))),
diff --git a/datafusion/core/src/datasource/avro_to_arrow/schema.rs b/datafusion/core/src/datasource/avro_to_arrow/schema.rs
index d4c881ca54..41b1d3c6e4 100644
--- a/datafusion/core/src/datasource/avro_to_arrow/schema.rs
+++ b/datafusion/core/src/datasource/avro_to_arrow/schema.rs
@@ -17,7 +17,9 @@
use crate::arrow::datatypes::{DataType, IntervalUnit, Schema, TimeUnit, UnionMode};
use crate::error::{DataFusionError, Result};
-use apache_avro::schema::{Alias, Name};
+use apache_avro::schema::{
+ Alias, DecimalSchema, EnumSchema, FixedSchema, Name, RecordSchema,
+};
use apache_avro::types::Value;
use apache_avro::Schema as AvroSchema;
use arrow::datatypes::{Field, UnionFields};
@@ -29,7 +31,7 @@ use std::sync::Arc;
pub fn to_arrow_schema(avro_schema: &apache_avro::Schema) -> Result<Schema> {
let mut schema_fields = vec![];
match avro_schema {
- AvroSchema::Record { fields, .. } => {
+ AvroSchema::Record(RecordSchema { fields, .. }) => {
for field in fields {
schema_fields.push(schema_to_field_with_props(
&field.schema,
@@ -84,7 +86,12 @@ fn schema_to_field_with_props(
}
AvroSchema::Union(us) => {
// If there are only two variants and one of them is null, set the other type as the field data type
- let has_nullable = us.find_schema(&Value::Null).is_some();
+ let has_nullable = us
+ .find_schema_with_known_schemata::<apache_avro::Schema>(
+ &Value::Null,
+ None,
+ )
+ .is_some();
let sub_schemas = us.variants();
if has_nullable && sub_schemas.len() == 2 {
nullable = true;
@@ -109,7 +116,7 @@ fn schema_to_field_with_props(
DataType::Union(UnionFields::new(type_ids, fields), UnionMode::Dense)
}
}
- AvroSchema::Record { name, fields, .. } => {
+ AvroSchema::Record(RecordSchema { name, fields, .. }) => {
let fields: Result<_> = fields
.iter()
.map(|field| {
@@ -130,7 +137,7 @@ fn schema_to_field_with_props(
.collect();
DataType::Struct(fields?)
}
- AvroSchema::Enum { symbols, name, .. } => {
+ AvroSchema::Enum(EnumSchema { symbols, name, .. }) => {
return Ok(Field::new_dict(
name.fullname(None),
index_type(symbols.len()),
@@ -139,10 +146,12 @@ fn schema_to_field_with_props(
false,
))
}
- AvroSchema::Fixed { size, .. } => DataType::FixedSizeBinary(*size as i32),
- AvroSchema::Decimal {
+ AvroSchema::Fixed(FixedSchema { size, .. }) => {
+ DataType::FixedSizeBinary(*size as i32)
+ }
+ AvroSchema::Decimal(DecimalSchema {
precision, scale, ..
- } => DataType::Decimal128(*precision as u8, *scale as i8),
+ }) => DataType::Decimal128(*precision as u8, *scale as i8),
AvroSchema::Uuid => DataType::FixedSizeBinary(16),
AvroSchema::Date => DataType::Date32,
AvroSchema::TimeMillis => DataType::Time32(TimeUnit::Millisecond),
@@ -241,35 +250,35 @@ fn index_type(len: usize) -> DataType {
fn external_props(schema: &AvroSchema) -> HashMap<String, String> {
let mut props = HashMap::new();
match &schema {
- AvroSchema::Record {
+ AvroSchema::Record(RecordSchema {
doc: Some(ref doc), ..
- }
- | AvroSchema::Enum {
+ })
+ | AvroSchema::Enum(EnumSchema {
doc: Some(ref doc), ..
- }
- | AvroSchema::Fixed {
+ })
+ | AvroSchema::Fixed(FixedSchema {
doc: Some(ref doc), ..
- } => {
+ }) => {
props.insert("avro::doc".to_string(), doc.clone());
}
_ => {}
}
match &schema {
- AvroSchema::Record {
+ AvroSchema::Record(RecordSchema {
name: Name { namespace, .. },
aliases: Some(aliases),
..
- }
- | AvroSchema::Enum {
+ })
+ | AvroSchema::Enum(EnumSchema {
name: Name { namespace, .. },
aliases: Some(aliases),
..
- }
- | AvroSchema::Fixed {
+ })
+ | AvroSchema::Fixed(FixedSchema {
name: Name { namespace, .. },
aliases: Some(aliases),
..
- } => {
+ }) => {
let aliases: Vec<String> = aliases
.iter()
.map(|alias| aliased(alias, namespace.as_deref(), None))
@@ -308,7 +317,7 @@ mod test {
use crate::arrow::datatypes::DataType::{Binary, Float32, Float64, Timestamp, Utf8};
use crate::arrow::datatypes::TimeUnit::Microsecond;
use crate::arrow::datatypes::{Field, Schema};
- use apache_avro::schema::{Alias, Name};
+ use apache_avro::schema::{Alias, EnumSchema, FixedSchema, Name, RecordSchema};
use apache_avro::Schema as AvroSchema;
use arrow::datatypes::DataType::{Boolean, Int32, Int64};
@@ -326,7 +335,7 @@ mod test {
#[test]
fn test_external_props() {
- let record_schema = AvroSchema::Record {
+ let record_schema = AvroSchema::Record(RecordSchema {
name: Name {
name: "record".to_string(),
namespace: None,
@@ -335,7 +344,8 @@ mod test {
doc: Some("record documentation".to_string()),
fields: vec![],
lookup: Default::default(),
- };
+ attributes: Default::default(),
+ });
let props = external_props(&record_schema);
assert_eq!(
props.get("avro::doc"),
@@ -345,7 +355,7 @@ mod test {
props.get("avro::aliases"),
Some(&"[fooalias,baralias]".to_string())
);
- let enum_schema = AvroSchema::Enum {
+ let enum_schema = AvroSchema::Enum(EnumSchema {
name: Name {
name: "enum".to_string(),
namespace: None,
@@ -353,7 +363,9 @@ mod test {
aliases: Some(vec![alias("fooenum"), alias("barenum")]),
doc: Some("enum documentation".to_string()),
symbols: vec![],
- };
+ default: None,
+ attributes: Default::default(),
+ });
let props = external_props(&enum_schema);
assert_eq!(
props.get("avro::doc"),
@@ -363,7 +375,7 @@ mod test {
props.get("avro::aliases"),
Some(&"[fooenum,barenum]".to_string())
);
- let fixed_schema = AvroSchema::Fixed {
+ let fixed_schema = AvroSchema::Fixed(FixedSchema {
name: Name {
name: "fixed".to_string(),
namespace: None,
@@ -371,7 +383,8 @@ mod test {
aliases: Some(vec![alias("foofixed"), alias("barfixed")]),
size: 1,
doc: None,
- };
+ attributes: Default::default(),
+ });
let props = external_props(&fixed_schema);
assert_eq!(
props.get("avro::aliases"),