Skip to content

Commit 00ed6a6

Browse files
committed
feat: Add more coercion rules for interval
1 parent 915a600 commit 00ed6a6

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

datafusion/physical-expr/src/coercion_rule/binary_rule.rs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -594,12 +594,41 @@ pub fn interval_coercion(
594594
| (Interval(_), Timestamp(unit, zone)) => {
595595
Some(Timestamp(unit.clone(), zone.clone()))
596596
}
597+
(Date32, Interval(_)) | (Interval(_), Date32) => {
598+
// TODO: this is not correct and should be replaced with correctly typed timestamp
599+
Some(Date32)
600+
}
601+
(Date64, Interval(_)) | (Interval(_), Date64) => {
602+
// TODO: this is not correct and should be replaced with correctly typed timestamp
603+
Some(Date64)
604+
}
597605
_ => None,
598606
},
599607
Operator::Multiply => match (lhs_type, rhs_type) {
600608
(Int64, Interval(itype)) | (Interval(itype), Int64) => {
601609
Some(Interval(itype.clone()))
602610
}
611+
(Int32, Interval(itype)) | (Interval(itype), Int32) => {
612+
Some(Interval(itype.clone()))
613+
}
614+
(Int16, Interval(itype)) | (Interval(itype), Int16) => {
615+
Some(Interval(itype.clone()))
616+
}
617+
(Int8, Interval(itype)) | (Interval(itype), Int8) => {
618+
Some(Interval(itype.clone()))
619+
}
620+
(UInt64, Interval(itype)) | (Interval(itype), UInt64) => {
621+
Some(Interval(itype.clone()))
622+
}
623+
(UInt32, Interval(itype)) | (Interval(itype), UInt32) => {
624+
Some(Interval(itype.clone()))
625+
}
626+
(UInt16, Interval(itype)) | (Interval(itype), UInt16) => {
627+
Some(Interval(itype.clone()))
628+
}
629+
(UInt8, Interval(itype)) | (Interval(itype), UInt8) => {
630+
Some(Interval(itype.clone()))
631+
}
603632
_ => None,
604633
},
605634
_ => None,

0 commit comments

Comments
 (0)