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

Alter Transform::Day to map partition types to Date rather than Int for consistency with reference implementation #479

Merged
merged 1 commit into from
Jul 25, 2024
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
2 changes: 1 addition & 1 deletion crates/iceberg/src/spec/partition.rs
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ mod tests {
NestedField::optional(
partition_spec.fields[0].field_id,
&partition_spec.fields[0].name,
Type::Primitive(crate::spec::PrimitiveType::Int)
Type::Primitive(crate::spec::PrimitiveType::Date)
)
);
assert_eq!(
Expand Down
2 changes: 1 addition & 1 deletion crates/iceberg/src/spec/transform.rs
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ impl Transform {
match p {
PrimitiveType::Timestamp
| PrimitiveType::Timestamptz
| PrimitiveType::Date => Ok(Type::Primitive(PrimitiveType::Int)),
| PrimitiveType::Date => Ok(Type::Primitive(PrimitiveType::Date)),
_ => Err(Error::new(
ErrorKind::DataInvalid,
format!("{input_type} is not a valid input type of {self} transform",),
Expand Down
18 changes: 9 additions & 9 deletions crates/iceberg/src/transform/temporal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ mod test {
],
trans_types: vec![
(Primitive(Binary), None),
(Primitive(Date), Some(Primitive(Int))),
(Primitive(Date), Some(Primitive(Date))),
(
Primitive(Decimal {
precision: 8,
Expand All @@ -342,8 +342,8 @@ mod test {
(Primitive(StringType), None),
(Primitive(Uuid), None),
(Primitive(Time), None),
(Primitive(Timestamp), Some(Primitive(Int))),
(Primitive(Timestamptz), Some(Primitive(Int))),
(Primitive(Timestamp), Some(Primitive(Date))),
(Primitive(Timestamptz), Some(Primitive(Date))),
(
Struct(StructType::new(vec![NestedField::optional(
1,
Expand Down Expand Up @@ -378,7 +378,7 @@ mod test {
],
trans_types: vec![
(Primitive(Binary), None),
(Primitive(Date), Some(Primitive(Int))),
(Primitive(Date), Some(Primitive(Date))),
(
Primitive(Decimal {
precision: 8,
Expand All @@ -392,8 +392,8 @@ mod test {
(Primitive(StringType), None),
(Primitive(Uuid), None),
(Primitive(Time), None),
(Primitive(Timestamp), Some(Primitive(Int))),
(Primitive(Timestamptz), Some(Primitive(Int))),
(Primitive(Timestamp), Some(Primitive(Date))),
(Primitive(Timestamptz), Some(Primitive(Date))),
(
Struct(StructType::new(vec![NestedField::optional(
1,
Expand Down Expand Up @@ -428,7 +428,7 @@ mod test {
],
trans_types: vec![
(Primitive(Binary), None),
(Primitive(Date), Some(Primitive(Int))),
(Primitive(Date), Some(Primitive(Date))),
(
Primitive(Decimal {
precision: 8,
Expand All @@ -442,8 +442,8 @@ mod test {
(Primitive(StringType), None),
(Primitive(Uuid), None),
(Primitive(Time), None),
(Primitive(Timestamp), Some(Primitive(Int))),
(Primitive(Timestamptz), Some(Primitive(Int))),
(Primitive(Timestamp), Some(Primitive(Date))),
(Primitive(Timestamptz), Some(Primitive(Date))),
(
Struct(StructType::new(vec![NestedField::optional(
1,
Expand Down
Loading