Skip to content

Commit 4ec520e

Browse files
committed
Update ResultType to Date
1 parent 7ae534c commit 4ec520e

2 files changed

Lines changed: 1 addition & 10 deletions

File tree

partitions.go

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -499,15 +499,6 @@ func (ps *PartitionSpec) PartitionType(schema *Schema) *StructType {
499499
continue
500500
}
501501
resultType := field.Transform.ResultType(sourceType)
502-
// DayTransform.ResultType returns Int32 (days since epoch), but the
503-
// Avro encoding of a day-partition column must carry the "date" logical
504-
// type so that Trino, Spark, and other engines can read manifests.
505-
// Override to DateType here so downstream schema conversion picks it up
506-
// automatically via the existing DateType branch, without coupling the
507-
// Avro layer to transform internals.
508-
if _, ok := field.Transform.(DayTransform); ok {
509-
resultType = PrimitiveTypes.Date
510-
}
511502
nestedFields = append(nestedFields, NestedField{
512503
ID: field.FieldID,
513504
Name: field.Name,

transforms.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -789,7 +789,7 @@ func (t DayTransform) MarshalText() ([]byte, error) {
789789
func (DayTransform) String() string { return "day" }
790790

791791
func (t DayTransform) CanTransform(sourceType Type) bool { return canTransformTime(t, sourceType) }
792-
func (DayTransform) ResultType(Type) Type { return PrimitiveTypes.Int32 }
792+
func (DayTransform) ResultType(Type) Type { return PrimitiveTypes.Date }
793793
func (DayTransform) PreservesOrder() bool { return true }
794794

795795
func (DayTransform) Equals(other Transform) bool {

0 commit comments

Comments
 (0)