Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to delta-rs 0.23.0 and set the new required rust version #207

Merged
merged 2 commits into from
Jan 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
[package]
name = "kafka-delta-ingest"
version = "0.3.0"
version = "0.4.0"
authors = ["R. Tyler Croy <[email protected]>", "Christian Williams <[email protected]>"]
edition = "2018"
rust-version = "1.81"

[dependencies]
flate2 = "1.0"
Expand Down Expand Up @@ -34,9 +35,9 @@ uuid = { version = "0.8", features = ["serde", "v4"] }
url = "2.3"

# datafusion feature is required for writer version 2
deltalake-core = { version = "0.21.0", features = ["json", "datafusion"]}
deltalake-aws = { version = "0.4.0", optional = true }
deltalake-azure = { version = "0.4.0", optional = true }
deltalake-core = { version = "0.23.0", features = ["json", "datafusion"]}
deltalake-aws = { version = "0.6.0", optional = true }
deltalake-azure = { version = "0.6.0", optional = true }

# s3 feature enabled, helps for locking interactions with DLQ
dynamodb_lock = { version = "0.6.0", optional = true }
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM rust:1.79 AS builder
FROM rust:1.81 AS builder

RUN mkdir /build
WORKDIR /build
Expand Down
18 changes: 13 additions & 5 deletions src/writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -856,7 +856,7 @@ fn min_and_max_from_parquet_statistics(

let stats_with_min_max: Vec<&Statistics> = statistics
.iter()
.filter(|s| s.has_min_max_set())
.filter(|s| s.min_bytes_opt().is_some() && s.max_bytes_opt().is_some())
.copied()
.collect();

Expand Down Expand Up @@ -892,13 +892,21 @@ fn min_and_max_from_parquet_statistics(
let min_array = arrow_array_from_bytes(
data_type.clone(),
arrow_buffer_capacity,
stats_with_min_max.iter().map(|s| s.min_bytes()).collect(),
// The stats should always exist in stats_with_min_max but defaulting to zero to avoid a
// panic
stats_with_min_max
.iter()
.map(|s| s.min_bytes_opt().unwrap_or(&[0]))
.collect(),
)?;

let max_array = arrow_array_from_bytes(
data_type.clone(),
arrow_buffer_capacity,
stats_with_min_max.iter().map(|s| s.max_bytes()).collect(),
stats_with_min_max
.iter()
.map(|s| s.max_bytes_opt().unwrap_or(&[0]))
.collect(),
)?;

match data_type {
Expand Down Expand Up @@ -990,15 +998,15 @@ fn min_max_strings_from_stats(
) -> (Option<Value>, Option<Value>) {
let min_string_candidates = stats_with_min_max
.iter()
.filter_map(|s| std::str::from_utf8(s.min_bytes()).ok());
.filter_map(|s| std::str::from_utf8(s.min_bytes_opt().unwrap_or(&[0])).ok());

let min_value = min_string_candidates
.min()
.map(|s| Value::String(s.to_string()));

let max_string_candidates = stats_with_min_max
.iter()
.filter_map(|s| std::str::from_utf8(s.max_bytes()).ok());
.filter_map(|s| std::str::from_utf8(s.max_bytes_opt().unwrap_or(&[0])).ok());

let max_value = max_string_candidates
.max()
Expand Down
Loading