Skip to content
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
11 changes: 6 additions & 5 deletions crates/catalog/rest/src/catalog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3832,13 +3832,14 @@ mod tests {
.properties(HashMap::from([("owner".to_string(), "testx".to_string())]))
.partition_spec(
UnboundPartitionSpec::builder()
.add_partition_fields(vec![
.add_partition_field(
UnboundPartitionField::builder()
.source_id(1)
.source_ids(vec![1])
.name("id")
.transform(Transform::Truncate(3))
.name("id".to_string())
.build(),
])
.build()
.unwrap(),
)
.unwrap()
.build(),
)
Expand Down
15 changes: 10 additions & 5 deletions crates/iceberg/public-api.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2911,17 +2911,22 @@ pub fn iceberg::spec::TableProperties<'properties>::write_target_file_size_bytes
impl<'properties> core::fmt::Debug for iceberg::spec::TableProperties<'properties>
pub fn iceberg::spec::TableProperties<'properties>::fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result
pub struct iceberg::spec::UnboundPartitionField
pub iceberg::spec::UnboundPartitionField::field_id: core::option::Option<i32>
pub iceberg::spec::UnboundPartitionField::name: alloc::string::String
pub iceberg::spec::UnboundPartitionField::source_id: i32
pub iceberg::spec::UnboundPartitionField::transform: iceberg::spec::Transform
impl iceberg::spec::UnboundPartitionField
pub fn iceberg::spec::UnboundPartitionField::field_id(&self) -> core::option::Option<i32>
pub fn iceberg::spec::UnboundPartitionField::name(&self) -> &str
pub fn iceberg::spec::UnboundPartitionField::source_id(&self) -> iceberg::Result<i32>
pub fn iceberg::spec::UnboundPartitionField::source_ids(&self) -> &[i32]
pub fn iceberg::spec::UnboundPartitionField::transform(&self) -> iceberg::spec::Transform
pub fn iceberg::spec::UnboundPartitionField::with_field_id(self, field_id: i32) -> Self
impl core::clone::Clone for iceberg::spec::UnboundPartitionField
pub fn iceberg::spec::UnboundPartitionField::clone(&self) -> iceberg::spec::UnboundPartitionField
impl core::cmp::Eq for iceberg::spec::UnboundPartitionField
impl core::cmp::PartialEq for iceberg::spec::UnboundPartitionField
pub fn iceberg::spec::UnboundPartitionField::eq(&self, other: &iceberg::spec::UnboundPartitionField) -> bool
impl core::convert::From<iceberg::spec::PartitionField> for iceberg::spec::UnboundPartitionField
pub fn iceberg::spec::UnboundPartitionField::from(field: iceberg::spec::PartitionField) -> Self
impl core::convert::From<iceberg::spec::UnboundPartitionField> for iceberg::Result<iceberg::spec::UnboundPartitionField>
pub fn iceberg::Result<iceberg::spec::UnboundPartitionField>::from(field: iceberg::spec::UnboundPartitionField) -> Self
impl core::fmt::Debug for iceberg::spec::UnboundPartitionField
pub fn iceberg::spec::UnboundPartitionField::fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result
impl core::marker::StructuralPartialEq for iceberg::spec::UnboundPartitionField
Expand Down Expand Up @@ -2956,7 +2961,7 @@ impl<'de> serde_core::de::Deserialize<'de> for iceberg::spec::UnboundPartitionSp
pub fn iceberg::spec::UnboundPartitionSpec::deserialize<__D>(__deserializer: __D) -> core::result::Result<Self, <__D as serde_core::de::Deserializer>::Error> where __D: serde_core::de::Deserializer<'de>
pub struct iceberg::spec::UnboundPartitionSpecBuilder
impl iceberg::spec::UnboundPartitionSpecBuilder
pub fn iceberg::spec::UnboundPartitionSpecBuilder::add_partition_field(self, source_id: i32, target_name: impl alloc::string::ToString, transformation: iceberg::spec::Transform) -> iceberg::Result<Self>
pub fn iceberg::spec::UnboundPartitionSpecBuilder::add_partition_field(self, field: iceberg::spec::UnboundPartitionField) -> iceberg::Result<Self>
pub fn iceberg::spec::UnboundPartitionSpecBuilder::add_partition_fields(self, fields: impl core::iter::traits::collect::IntoIterator<Item = iceberg::spec::UnboundPartitionField>) -> iceberg::Result<Self>
pub fn iceberg::spec::UnboundPartitionSpecBuilder::build(self) -> iceberg::spec::UnboundPartitionSpec
pub fn iceberg::spec::UnboundPartitionSpecBuilder::new() -> Self
Expand Down
28 changes: 16 additions & 12 deletions crates/iceberg/src/arrow/record_batch_partition_splitter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -244,12 +244,14 @@ mod tests {
let partition_spec = Arc::new(
PartitionSpecBuilder::new(schema.clone())
.with_spec_id(1)
.add_unbound_field(UnboundPartitionField {
source_id: 1,
field_id: None,
name: "id_bucket".to_string(),
transform: Transform::Identity,
})
.add_unbound_field(
UnboundPartitionField::builder()
.source_ids(vec![1])
.name("id_bucket".to_string())
.transform(Transform::Identity)
.build()
.unwrap(),
)
.unwrap()
.build()
.unwrap(),
Expand Down Expand Up @@ -358,12 +360,14 @@ mod tests {
let partition_spec = Arc::new(
PartitionSpecBuilder::new(schema.clone())
.with_spec_id(1)
.add_unbound_field(UnboundPartitionField {
source_id: 1,
field_id: None,
name: "id_bucket".to_string(),
transform: Transform::Identity,
})
.add_unbound_field(
UnboundPartitionField::builder()
.source_ids(vec![1])
.name("id_bucket".to_string())
.transform(Transform::Identity)
.build()
.unwrap(),
)
.unwrap()
.build()
.unwrap(),
Expand Down
31 changes: 26 additions & 5 deletions crates/iceberg/src/catalog/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1103,8 +1103,8 @@ mod tests {
PartitionStatisticsFile, PrimitiveType, Schema, Snapshot, SnapshotReference,
SnapshotRetention, SortDirection, SortField, SortOrder, SqlViewRepresentation,
StatisticsFile, Summary, TableMetadata, TableMetadataBuilder, Transform, Type,
UnboundPartitionSpec, ViewFormatVersion, ViewRepresentation, ViewRepresentations,
ViewVersion,
UnboundPartitionField, UnboundPartitionSpec, ViewFormatVersion, ViewRepresentation,
ViewRepresentations, ViewVersion,
};
use crate::table::Table;
use crate::test_utils::test_runtime;
Expand Down Expand Up @@ -1659,11 +1659,32 @@ mod tests {
"#,
TableUpdate::AddSpec {
spec: UnboundPartitionSpec::builder()
.add_partition_field(4, "ts_day".to_string(), Transform::Day)
.add_partition_field(
UnboundPartitionField::builder()
.source_ids(vec![4])
.name("ts_day")
.transform(Transform::Day)
.build()
.unwrap(),
)
.unwrap()
.add_partition_field(1, "id_bucket".to_string(), Transform::Bucket(16))
.add_partition_field(
UnboundPartitionField::builder()
.source_ids(vec![1])
.name("id_bucket")
.transform(Transform::Bucket(16))
.build()
.unwrap(),
)
.unwrap()
.add_partition_field(2, "id_truncate".to_string(), Transform::Truncate(4))
.add_partition_field(
UnboundPartitionField::builder()
.source_ids(vec![2])
.name("id_truncate")
.transform(Transform::Truncate(4))
.build()
.unwrap(),
)
.unwrap()
.build(),
},
Expand Down
5 changes: 3 additions & 2 deletions crates/iceberg/src/expr/visitors/expression_evaluator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -280,11 +280,12 @@ mod tests {
.with_spec_id(1)
.add_unbound_field(
UnboundPartitionField::builder()
.source_id(1)
.source_ids(vec![1])
.name("a".to_string())
.field_id(1)
.transform(Transform::Identity)
.build(),
.build()
.unwrap(),
)
.unwrap()
.build()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1661,11 +1661,12 @@ mod test {
.with_spec_id(1)
.add_unbound_fields(vec![
UnboundPartitionField::builder()
.source_id(1)
.source_ids(vec![1])
.name("a".to_string())
.field_id(1)
.transform(Transform::Identity)
.build(),
.build()
.unwrap(),
])
.unwrap()
.build()
Expand Down
60 changes: 36 additions & 24 deletions crates/iceberg/src/expr/visitors/inclusive_projection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -304,11 +304,12 @@ mod tests {
.with_spec_id(1)
.add_unbound_field(
UnboundPartitionField::builder()
.source_id(1)
.source_ids(vec![1])
.name("a".to_string())
.field_id(1)
.transform(Transform::Identity)
.build(),
.build()
.unwrap(),
)
.unwrap()
.build()
Expand Down Expand Up @@ -339,12 +340,15 @@ mod tests {

let partition_spec = PartitionSpec::builder(arc_schema.clone())
.with_spec_id(1)
.add_unbound_fields(vec![UnboundPartitionField {
source_id: 2,
name: "year".to_string(),
field_id: Some(1000),
transform: Transform::Year,
}])
.add_unbound_fields(vec![
UnboundPartitionField::builder()
.source_ids(vec![2])
.field_id(1000)
.name("year".to_string())
.transform(Transform::Year)
.build()
.unwrap(),
])
.unwrap()
.build()
.unwrap();
Expand Down Expand Up @@ -374,12 +378,15 @@ mod tests {

let partition_spec = PartitionSpec::builder(arc_schema.clone())
.with_spec_id(1)
.add_unbound_fields(vec![UnboundPartitionField {
source_id: 2,
name: "month".to_string(),
field_id: Some(1000),
transform: Transform::Month,
}])
.add_unbound_fields(vec![
UnboundPartitionField::builder()
.source_ids(vec![2])
.field_id(1000)
.name("month".to_string())
.transform(Transform::Month)
.build()
.unwrap(),
])
.unwrap()
.build()
.unwrap();
Expand Down Expand Up @@ -409,12 +416,15 @@ mod tests {

let partition_spec = PartitionSpec::builder(arc_schema.clone())
.with_spec_id(1)
.add_unbound_fields(vec![UnboundPartitionField {
source_id: 2,
name: "day".to_string(),
field_id: Some(1000),
transform: Transform::Day,
}])
.add_unbound_fields(vec![
UnboundPartitionField::builder()
.source_ids(vec![2])
.field_id(1000)
.name("day".to_string())
.transform(Transform::Day)
.build()
.unwrap(),
])
.unwrap()
.build()
.unwrap();
Expand Down Expand Up @@ -446,11 +456,12 @@ mod tests {
.with_spec_id(1)
.add_unbound_field(
UnboundPartitionField::builder()
.source_id(3)
.source_ids(vec![3])
.name("name_truncate".to_string())
.field_id(3)
.transform(Transform::Truncate(4))
.build(),
.build()
.unwrap(),
)
.unwrap()
.build()
Expand Down Expand Up @@ -486,11 +497,12 @@ mod tests {
.with_spec_id(1)
.add_unbound_field(
UnboundPartitionField::builder()
.source_id(1)
.source_ids(vec![1])
.name("a_bucket[7]".to_string())
.field_id(1)
.transform(Transform::Bucket(7))
.build(),
.build()
.unwrap(),
)
.unwrap()
.build()
Expand Down
Loading
Loading