Skip to content

Commit 5765a08

Browse files
authored
Switch from xz2 to liblzma to reduce duplicate dependencies (#17509)
## Which issue does this PR close? Closes #15342 ## Rationale for this change Reduces the duplicate dependencies. We currently depend on bzip2 in two different ways. In attempting to reduce this, I needed to update `async-compression` which caused two different libraries to link to the system lzma library. This is not allowed in rust. This PR updates avro-rs, but we cannot merge this PR until that crate merges apache/avro-rs#284 and we remove the crates.io patch this PR contains. ## What changes are included in this PR? Update avro-rs and switch from the unmaintained xz2 crate to liblzma. ## Are these changes tested? Unit tests. ## Are there any user-facing changes? None. This is simply a dependency update to a more recent crate.
1 parent 19865b3 commit 5765a08

File tree

7 files changed

+65
-66
lines changed

7 files changed

+65
-66
lines changed

Cargo.lock

Lines changed: 53 additions & 55 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ version = "51.0.0"
9090
ahash = { version = "0.8", default-features = false, features = [
9191
"runtime-rng",
9292
] }
93-
apache-avro = { version = "0.20", default-features = false }
93+
apache-avro = { version = "0.21", default-features = false }
9494
arrow = { version = "57.0.0", features = [
9595
"prettyprint",
9696
"chrono-tz",
@@ -158,6 +158,7 @@ hex = { version = "0.4.3" }
158158
indexmap = "2.12.0"
159159
insta = { version = "1.43.2", features = ["glob", "filters"] }
160160
itertools = "0.14"
161+
liblzma = { version = "0.4.4", features = ["static"] }
161162
log = "^0.4"
162163
num-traits = { version = "0.2" }
163164
object_store = { version = "0.12.4", default-features = false }

datafusion/common/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ sql = ["sqlparser"]
5656

5757
[dependencies]
5858
ahash = { workspace = true }
59-
apache-avro = { version = "0.20", default-features = false, features = [
59+
apache-avro = { workspace = true, features = [
6060
"bzip",
6161
"snappy",
6262
"xz",

datafusion/core/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ array_expressions = ["nested_expressions"]
4646
avro = ["datafusion-common/avro", "datafusion-datasource-avro"]
4747
backtrace = ["datafusion-common/backtrace"]
4848
compression = [
49-
"xz2",
49+
"liblzma",
5050
"bzip2",
5151
"flate2",
5252
"zstd",
@@ -146,6 +146,7 @@ datafusion-sql = { workspace = true, optional = true }
146146
flate2 = { version = "1.1.4", optional = true }
147147
futures = { workspace = true }
148148
itertools = { workspace = true }
149+
liblzma = { workspace = true, optional = true }
149150
log = { workspace = true }
150151
object_store = { workspace = true }
151152
parking_lot = { workspace = true }
@@ -159,7 +160,6 @@ tempfile = { workspace = true }
159160
tokio = { workspace = true }
160161
url = { workspace = true }
161162
uuid = { version = "1.18", features = ["v4", "js"] }
162-
xz2 = { version = "0.1", optional = true, features = ["static"] }
163163
zstd = { version = "0.13", optional = true, default-features = false }
164164

165165
[dev-dependencies]

datafusion/core/src/test/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,9 @@ use datafusion_datasource_csv::partitioned_csv_config;
5656
use flate2::write::GzEncoder;
5757
#[cfg(feature = "compression")]
5858
use flate2::Compression as GzCompression;
59-
use object_store::local_unpartitioned_file;
6059
#[cfg(feature = "compression")]
61-
use xz2::write::XzEncoder;
60+
use liblzma::write::XzEncoder;
61+
use object_store::local_unpartitioned_file;
6262
#[cfg(feature = "compression")]
6363
use zstd::Encoder as ZstdEncoder;
6464

datafusion/datasource/Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,12 @@ version.workspace = true
3131
all-features = true
3232

3333
[features]
34-
compression = ["async-compression", "xz2", "bzip2", "flate2", "zstd", "tokio-util"]
34+
compression = ["async-compression", "liblzma", "bzip2", "flate2", "zstd", "tokio-util"]
3535
default = ["compression"]
3636

3737
[dependencies]
3838
arrow = { workspace = true }
39-
async-compression = { version = "0.4.19", features = [
39+
async-compression = { version = "0.4.30", features = [
4040
"bzip2",
4141
"gzip",
4242
"xz",
@@ -60,14 +60,14 @@ flate2 = { version = "1.1.4", optional = true }
6060
futures = { workspace = true }
6161
glob = "0.3.0"
6262
itertools = { workspace = true }
63+
liblzma = { workspace = true, optional = true }
6364
log = { workspace = true }
6465
object_store = { workspace = true }
6566
rand = { workspace = true }
6667
tempfile = { workspace = true, optional = true }
6768
tokio = { workspace = true }
6869
tokio-util = { version = "0.7.16", features = ["io"], optional = true }
6970
url = { workspace = true }
70-
xz2 = { version = "0.1", optional = true, features = ["static"] }
7171
zstd = { version = "0.13", optional = true, default-features = false }
7272

7373
[dev-dependencies]

datafusion/datasource/src/file_compression_type.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,13 @@ use futures::stream::BoxStream;
4343
use futures::StreamExt;
4444
#[cfg(feature = "compression")]
4545
use futures::TryStreamExt;
46+
#[cfg(feature = "compression")]
47+
use liblzma::read::XzDecoder;
4648
use object_store::buffered::BufWriter;
4749
use tokio::io::AsyncWrite;
4850
#[cfg(feature = "compression")]
4951
use tokio_util::io::{ReaderStream, StreamReader};
5052
#[cfg(feature = "compression")]
51-
use xz2::read::XzDecoder;
52-
#[cfg(feature = "compression")]
5353
use zstd::Decoder as ZstdDecoder;
5454

5555
/// Readable file compression type

0 commit comments

Comments
 (0)