Skip to content

Commit

Permalink
Merge branch 'main' into feat/cherry-make-rest-methods-pub
Browse files Browse the repository at this point in the history
  • Loading branch information
peasee authored Jan 30, 2025
2 parents 6d90539 + bd3f2ec commit 18babc3
Show file tree
Hide file tree
Showing 5 changed files with 88 additions and 29 deletions.
1 change: 1 addition & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,4 @@ updates:
schedule:
interval: "weekly"
day: "sunday"
open-pull-requests-limit: 50
78 changes: 54 additions & 24 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ array-init = "2"
arrow-arith = { version = "53.3.0" }
arrow-array = { version = "53.4.0" }
arrow-cast = { version = "53.3.0" }
arrow-ord = { version = "53.3.0" }
arrow-ord = { version = "53.4.0" }
arrow-schema = { version = "53.4.0" }
arrow-select = { version = "53.3.0" }
arrow-select = { version = "53.4.0" }
arrow-string = { version = "53.3.0" }
async-stream = "0.3.5"
async-trait = "0.1.85"
Expand Down Expand Up @@ -89,10 +89,10 @@ rust_decimal = "1.31"
serde = { version = "1.0.204", features = ["rc"] }
serde_bytes = "0.11.15"
serde_derive = "1.0.204"
serde_json = "1.0.120"
serde_json = "1.0.138"
serde_repr = "0.1.16"
serde_with = "3.4"
tempfile = "3.15"
tempfile = "3.16"
tokio = { version = "1.36", default-features = false }
typed-builder = "0.20"
url = "2.2.2"
Expand Down
2 changes: 1 addition & 1 deletion crates/catalog/s3tables/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ keywords = ["iceberg", "sql", "catalog"]
anyhow = { workspace = true }
async-trait = { workspace = true }
aws-config = { workspace = true }
aws-sdk-s3tables = "1.6.0"
aws-sdk-s3tables = "1.7.0"
iceberg = { workspace = true }
serde_json = { workspace = true }
uuid = { workspace = true, features = ["v4"] }
Expand Down
28 changes: 28 additions & 0 deletions crates/iceberg/src/transform/truncate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ impl Truncate {
}
}

#[inline]
fn truncate_binary(s: &[u8], width: usize) -> &[u8] {
&s[0..width]
}

#[inline]
fn truncate_i32(v: i32, width: i32) -> i32 {
v - v.rem_euclid(width)
Expand Down Expand Up @@ -119,6 +124,18 @@ impl TransformFunction for Truncate {
);
Ok(Arc::new(res))
}
DataType::Binary => {
let len = self.width as usize;
let res: arrow_array::BinaryArray = arrow_array::BinaryArray::from_iter(
input
.as_any()
.downcast_ref::<arrow_array::BinaryArray>()
.unwrap()
.iter()
.map(|v| v.map(|v| Self::truncate_binary(v, len))),
);
Ok(Arc::new(res))
}
_ => Err(crate::Error::new(
crate::ErrorKind::FeatureUnsupported,
format!(
Expand Down Expand Up @@ -747,6 +764,17 @@ mod test {
.value(0),
"ice"
);

// test binary
let input = Arc::new(arrow_array::BinaryArray::from_vec(vec![b"iceberg"]));
let res = super::Truncate::new(3).transform(input).unwrap();
assert_eq!(
res.as_any()
.downcast_ref::<arrow_array::BinaryArray>()
.unwrap()
.value(0),
b"ice"
);
}

#[test]
Expand Down

0 comments on commit 18babc3

Please sign in to comment.