diff --git a/crates/iceberg/src/spec/values.rs b/crates/iceberg/src/spec/values.rs
index f31d64779..6f62f2902 100644
--- a/crates/iceberg/src/spec/values.rs
+++ b/crates/iceberg/src/spec/values.rs
@@ -673,6 +673,16 @@ impl Datum {
)),
}
}
+
+ /// Get the primitive literal from datum.
+ pub fn literal(&self) -> &PrimitiveLiteral {
+ &self.literal
+ }
+
+ /// Get the primitive type from datum.
+ pub fn data_type(&self) -> &PrimitiveType {
+ &self.r#type
+ }
}
/// Values present in iceberg type
diff --git a/crates/iceberg/src/transform/bucket.rs b/crates/iceberg/src/transform/bucket.rs
index 435426191..015aceaf4 100644
--- a/crates/iceberg/src/transform/bucket.rs
+++ b/crates/iceberg/src/transform/bucket.rs
@@ -20,7 +20,7 @@ use std::sync::Arc;
use arrow_array::ArrayRef;
use arrow_schema::{DataType, TimeUnit};
-use crate::spec::{Literal, PrimitiveLiteral};
+use crate::spec::{Datum, PrimitiveLiteral};
use super::TransformFunction;
@@ -208,45 +208,42 @@ impl TransformFunction for Bucket {
.iter()
.map(|v| v.map(|v| self.bucket_bytes(v))),
),
- _ => unreachable!("Unsupported data type: {:?}", input.data_type()),
+ _ => {
+ return Err(crate::Error::new(
+ crate::ErrorKind::FeatureUnsupported,
+ format!(
+ "Unsupported data type for bucket transform: {:?}",
+ input.data_type()
+ ),
+ ))
+ }
};
Ok(Arc::new(res))
}
- fn transform_literal(&self, input: &Literal) -> crate::Result