You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "jackwener (via GitHub)" <gi...@apache.org> on 2023/05/24 13:35:25 UTC
[GitHub] [arrow-datafusion] jackwener commented on a diff in pull request #6433: Refactor temporal arithmetic
jackwener commented on code in PR #6433:
URL: https://github.com/apache/arrow-datafusion/pull/6433#discussion_r1204151448
##########
datafusion/physical-expr/src/expressions/binary.rs:
##########
@@ -1519,18 +1628,94 @@ pub fn ts_scalar_interval_op(
array.data_type()
)))?,
};
- Ok(ColumnarValue::Array(ret))
+ Ok(ret)
}
-macro_rules! sub_interval_macro {
+/// This function handles timestamp +/- interval operations where the former is
+/// a scalar and the latter is an array, resulting in an array.
+pub fn scalar_ts_op_interval(
+ scalar: &ScalarValue,
+ sign: i32,
+ array: &ArrayRef,
+) -> Result<ArrayRef> {
+ let ret = match (scalar, array.data_type()) {
Review Comment:
We can use `use ScalarValue::*` `use DataType::*` `use IntervalUnit::*` to simplify code
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org