You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem or challenge? Please describe what you are trying to do.
The timestamp variants (TimestampSecond, TimestampMillisecond ...) in ScalarValue cannot be subtracted from the same timestamp variant. I think we can subtract the timestamp within each variant and get some interval data variants (IntervalYearMonth, IntervalDayTime).
Describe the solution you'd like
There is a function in scalar.rs:
fn do_date_math<D>(prior: D, scalar: &ScalarValue, sign: i32) -> Result<D>
where
D: Datelike + Add<Duration, Output = D>,
{
Ok(match scalar {
ScalarValue::IntervalDayTime(Some(i)) => add_day_time(prior, *i, sign),
ScalarValue::IntervalYearMonth(Some(i)) => shift_months(prior, *i * sign),
ScalarValue::IntervalMonthDayNano(Some(i)) => add_m_d_nano(prior, *i, sign),
other => Err(DataFusionError::Execution(format!(
"DateIntervalExpr does not support non-interval type {other:?}"
)))?,
})
}
This function can be extended to handle the subtraction of timestamps and can return an interval variant.
Describe alternatives you've considered
Before entering do_date_math function, these cases can be handled with an alternative function in impl_op macro.
Additional context
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem or challenge? Please describe what you are trying to do.
The timestamp variants (
TimestampSecond
,TimestampMillisecond
...) inScalarValue
cannot be subtracted from the same timestamp variant. I think we can subtract the timestamp within each variant and get some interval data variants (IntervalYearMonth
,IntervalDayTime
).Describe the solution you'd like
There is a function in scalar.rs:
This function can be extended to handle the subtraction of timestamps and can return an interval variant.
Describe alternatives you've considered
Before entering
do_date_math
function, these cases can be handled with an alternative function inimpl_op
macro.Additional context
The text was updated successfully, but these errors were encountered: