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/04/09 12:11:03 UTC
[GitHub] [arrow-datafusion] jackwener opened a new pull request, #5932: just match for BinaryExpr Date/Time +/- Interval
jackwener opened a new pull request, #5932:
URL: https://github.com/apache/arrow-datafusion/pull/5932
# Which issue does this PR close?
Closes #.
# Rationale for this change
- remove result in temporal_add_sub_coercion()
- just match for BinaryExpr Date/Time +/- Interval
# What changes are included in this PR?
<!--
There is no need to duplicate the description in the issue here but it is sometimes worth providing a summary of the individual changes in this PR.
-->
# Are these changes tested?
<!--
We typically require tests for all PRs in order to:
1. Prevent the code from being accidentally broken by subsequent changes
2. Serve as another way to document the expected behavior of the code
If tests are not included in your PR, please explain why (for example, are they covered by existing tests)?
-->
# Are there any user-facing changes?
<!--
If there are user-facing changes then we may require documentation to be updated before approving the PR.
-->
<!--
If there are any breaking changes to public APIs, please add the `api change` label.
-->
--
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
[GitHub] [arrow-datafusion] berkaysynnada commented on a diff in pull request #5932: just match for BinaryExpr Date/Time +/- Interval
Posted by "berkaysynnada (via GitHub)" <gi...@apache.org>.
berkaysynnada commented on code in PR #5932:
URL: https://github.com/apache/arrow-datafusion/pull/5932#discussion_r1162377202
##########
datafusion/expr/src/type_coercion/binary.rs:
##########
@@ -276,18 +280,16 @@ fn handle_timestamp_minus(lhs: &DataType, rhs: &DataType) -> Result<Option<DataT
| (
DataType::Timestamp(TimeUnit::Millisecond, _),
DataType::Timestamp(TimeUnit::Millisecond, _),
- ) => Ok(Some(DataType::Interval(IntervalUnit::DayTime))),
+ ) => Some(DataType::Interval(IntervalUnit::DayTime)),
(
DataType::Timestamp(TimeUnit::Microsecond, _),
DataType::Timestamp(TimeUnit::Microsecond, _),
)
| (
DataType::Timestamp(TimeUnit::Nanosecond, _),
DataType::Timestamp(TimeUnit::Nanosecond, _),
- ) => Ok(Some(DataType::Interval(IntervalUnit::MonthDayNano))),
- (_, _) => Err(DataFusionError::Plan(
- "The timestamps have different types".to_string(),
- )),
+ ) => Some(DataType::Interval(IntervalUnit::MonthDayNano)),
+ (_, _) => None,
Review Comment:
Yes, the subtraction of different timestamp types needs special handling. I think if the operation is done with second or millisecond-precision timestamps, `IntervalDayTime` type could be coerced, and for the other timestamp types `IntervalMonthDayNano` seems to be the only option.
--
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
[GitHub] [arrow-datafusion] jackwener commented on a diff in pull request #5932: just match for BinaryExpr Date/Time +/- Interval
Posted by "jackwener (via GitHub)" <gi...@apache.org>.
jackwener commented on code in PR #5932:
URL: https://github.com/apache/arrow-datafusion/pull/5932#discussion_r1161322312
##########
datafusion/expr/src/type_coercion/binary.rs:
##########
@@ -217,57 +217,61 @@ pub fn temporal_add_sub_coercion(
lhs_type: &DataType,
rhs_type: &DataType,
op: &Operator,
-) -> Result<Option<DataType>> {
+) -> Option<DataType> {
match (lhs_type, rhs_type, op) {
// if an interval is being added/subtracted from a date/timestamp, return the date/timestamp data type
(lhs, rhs, _) if is_interval(lhs) && (is_date(rhs) || is_timestamp(rhs)) => {
- Ok(Some(rhs.clone()))
+ Some(rhs.clone())
}
(lhs, rhs, _) if is_interval(rhs) && (is_date(lhs) || is_timestamp(lhs)) => {
- Ok(Some(lhs.clone()))
+ Some(lhs.clone())
}
// if two timestamps are being subtracted, check their time units and return the corresponding interval data type
(lhs, rhs, Operator::Minus) if is_timestamp(lhs) && is_timestamp(rhs) => {
handle_timestamp_minus(lhs, rhs)
}
// if two intervals are being added/subtracted, check their interval units and return the corresponding interval data type
- (lhs, rhs, _) if is_interval(lhs) && is_interval(rhs) => handle_interval_addition(lhs, rhs),
+ (lhs, rhs, _) if is_interval(lhs) && is_interval(rhs) => {
+ handle_interval_addition(lhs, rhs)
+ }
// if two date/timestamp are being added/subtracted, return an error indicating that the operation is not supported
- (lhs, rhs, _) if (is_date(lhs) || is_timestamp(lhs)) && (is_date(rhs) || is_timestamp(rhs)) => {
- Err(DataFusionError::Plan(format!(
- "{lhs_type:?} {rhs_type:?} is an unsupported operation. addition/subtraction on dates/timestamps only supported with interval types"
- )))
+ (lhs, rhs, Operator::Minus)
+ if (is_date(lhs) || is_timestamp(lhs))
+ && (is_date(rhs) || is_timestamp(rhs)) =>
+ {
+ // TODO: support Minus
Review Comment:
None will be convert to Err outside.
Here use None is right. If here return Err, other None also need to be Err (keep samebehavior)
##########
datafusion/expr/src/type_coercion/binary.rs:
##########
@@ -217,57 +217,61 @@ pub fn temporal_add_sub_coercion(
lhs_type: &DataType,
rhs_type: &DataType,
op: &Operator,
-) -> Result<Option<DataType>> {
+) -> Option<DataType> {
match (lhs_type, rhs_type, op) {
// if an interval is being added/subtracted from a date/timestamp, return the date/timestamp data type
(lhs, rhs, _) if is_interval(lhs) && (is_date(rhs) || is_timestamp(rhs)) => {
- Ok(Some(rhs.clone()))
+ Some(rhs.clone())
}
(lhs, rhs, _) if is_interval(rhs) && (is_date(lhs) || is_timestamp(lhs)) => {
- Ok(Some(lhs.clone()))
+ Some(lhs.clone())
}
// if two timestamps are being subtracted, check their time units and return the corresponding interval data type
(lhs, rhs, Operator::Minus) if is_timestamp(lhs) && is_timestamp(rhs) => {
handle_timestamp_minus(lhs, rhs)
}
// if two intervals are being added/subtracted, check their interval units and return the corresponding interval data type
- (lhs, rhs, _) if is_interval(lhs) && is_interval(rhs) => handle_interval_addition(lhs, rhs),
+ (lhs, rhs, _) if is_interval(lhs) && is_interval(rhs) => {
+ handle_interval_addition(lhs, rhs)
+ }
// if two date/timestamp are being added/subtracted, return an error indicating that the operation is not supported
- (lhs, rhs, _) if (is_date(lhs) || is_timestamp(lhs)) && (is_date(rhs) || is_timestamp(rhs)) => {
- Err(DataFusionError::Plan(format!(
- "{lhs_type:?} {rhs_type:?} is an unsupported operation. addition/subtraction on dates/timestamps only supported with interval types"
- )))
+ (lhs, rhs, Operator::Minus)
+ if (is_date(lhs) || is_timestamp(lhs))
+ && (is_date(rhs) || is_timestamp(rhs)) =>
+ {
+ // TODO: support Minus
Review Comment:
None will be convert to Err outside.
Here use None is right. If here return Err, other None also need to be Err (keep same behavior)
--
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
[GitHub] [arrow-datafusion] comphead commented on a diff in pull request #5932: just match for BinaryExpr Date/Time +/- Interval
Posted by "comphead (via GitHub)" <gi...@apache.org>.
comphead commented on code in PR #5932:
URL: https://github.com/apache/arrow-datafusion/pull/5932#discussion_r1161361824
##########
datafusion/expr/src/type_coercion/binary.rs:
##########
@@ -217,57 +217,61 @@ pub fn temporal_add_sub_coercion(
lhs_type: &DataType,
rhs_type: &DataType,
op: &Operator,
-) -> Result<Option<DataType>> {
+) -> Option<DataType> {
match (lhs_type, rhs_type, op) {
// if an interval is being added/subtracted from a date/timestamp, return the date/timestamp data type
(lhs, rhs, _) if is_interval(lhs) && (is_date(rhs) || is_timestamp(rhs)) => {
- Ok(Some(rhs.clone()))
+ Some(rhs.clone())
}
(lhs, rhs, _) if is_interval(rhs) && (is_date(lhs) || is_timestamp(lhs)) => {
- Ok(Some(lhs.clone()))
+ Some(lhs.clone())
}
// if two timestamps are being subtracted, check their time units and return the corresponding interval data type
(lhs, rhs, Operator::Minus) if is_timestamp(lhs) && is_timestamp(rhs) => {
handle_timestamp_minus(lhs, rhs)
}
// if two intervals are being added/subtracted, check their interval units and return the corresponding interval data type
- (lhs, rhs, _) if is_interval(lhs) && is_interval(rhs) => handle_interval_addition(lhs, rhs),
+ (lhs, rhs, _) if is_interval(lhs) && is_interval(rhs) => {
+ handle_interval_addition(lhs, rhs)
+ }
// if two date/timestamp are being added/subtracted, return an error indicating that the operation is not supported
- (lhs, rhs, _) if (is_date(lhs) || is_timestamp(lhs)) && (is_date(rhs) || is_timestamp(rhs)) => {
- Err(DataFusionError::Plan(format!(
- "{lhs_type:?} {rhs_type:?} is an unsupported operation. addition/subtraction on dates/timestamps only supported with interval types"
- )))
+ (lhs, rhs, Operator::Minus)
+ if (is_date(lhs) || is_timestamp(lhs))
+ && (is_date(rhs) || is_timestamp(rhs)) =>
+ {
+ // TODO: support Minus
Review Comment:
in that case the comment doesn't make sense
https://github.com/apache/arrow-datafusion/pull/5932/files#diff-6a1eb5571196f1bd9f3defbbd97ed99e0e527e4ede426ce7e802ab949f1c431eR237
--
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
[GitHub] [arrow-datafusion] alamb commented on pull request #5932: just match for BinaryExpr Date/Time +/- Interval
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on PR #5932:
URL: https://github.com/apache/arrow-datafusion/pull/5932#issuecomment-1502085860
cc @berkaysynnada who I think added the coercion for timestamp related functions
--
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
[GitHub] [arrow-datafusion] waynexia commented on a diff in pull request #5932: just match for BinaryExpr Date/Time +/- Interval
Posted by "waynexia (via GitHub)" <gi...@apache.org>.
waynexia commented on code in PR #5932:
URL: https://github.com/apache/arrow-datafusion/pull/5932#discussion_r1161656234
##########
datafusion/expr/src/type_coercion/binary.rs:
##########
@@ -217,57 +217,61 @@ pub fn temporal_add_sub_coercion(
lhs_type: &DataType,
rhs_type: &DataType,
op: &Operator,
-) -> Result<Option<DataType>> {
+) -> Option<DataType> {
match (lhs_type, rhs_type, op) {
// if an interval is being added/subtracted from a date/timestamp, return the date/timestamp data type
(lhs, rhs, _) if is_interval(lhs) && (is_date(rhs) || is_timestamp(rhs)) => {
- Ok(Some(rhs.clone()))
+ Some(rhs.clone())
}
(lhs, rhs, _) if is_interval(rhs) && (is_date(lhs) || is_timestamp(lhs)) => {
- Ok(Some(lhs.clone()))
+ Some(lhs.clone())
}
// if two timestamps are being subtracted, check their time units and return the corresponding interval data type
(lhs, rhs, Operator::Minus) if is_timestamp(lhs) && is_timestamp(rhs) => {
handle_timestamp_minus(lhs, rhs)
}
// if two intervals are being added/subtracted, check their interval units and return the corresponding interval data type
- (lhs, rhs, _) if is_interval(lhs) && is_interval(rhs) => handle_interval_addition(lhs, rhs),
+ (lhs, rhs, _) if is_interval(lhs) && is_interval(rhs) => {
+ handle_interval_addition(lhs, rhs)
+ }
// if two date/timestamp are being added/subtracted, return an error indicating that the operation is not supported
- (lhs, rhs, _) if (is_date(lhs) || is_timestamp(lhs)) && (is_date(rhs) || is_timestamp(rhs)) => {
- Err(DataFusionError::Plan(format!(
- "{lhs_type:?} {rhs_type:?} is an unsupported operation. addition/subtraction on dates/timestamps only supported with interval types"
- )))
+ (lhs, rhs, Operator::Minus)
+ if (is_date(lhs) || is_timestamp(lhs))
+ && (is_date(rhs) || is_timestamp(rhs)) =>
+ {
+ // TODO: support Minus
Review Comment:
And this comment https://github.com/apache/arrow-datafusion/pull/5932/files#diff-6a1eb5571196f1bd9f3defbbd97ed99e0e527e4ede426ce7e802ab949f1c431eR214-R215
--
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
[GitHub] [arrow-datafusion] jackwener commented on a diff in pull request #5932: just match for BinaryExpr Date/Time +/- Interval
Posted by "jackwener (via GitHub)" <gi...@apache.org>.
jackwener commented on code in PR #5932:
URL: https://github.com/apache/arrow-datafusion/pull/5932#discussion_r1161439193
##########
datafusion/expr/src/type_coercion/binary.rs:
##########
@@ -217,57 +217,61 @@ pub fn temporal_add_sub_coercion(
lhs_type: &DataType,
rhs_type: &DataType,
op: &Operator,
-) -> Result<Option<DataType>> {
+) -> Option<DataType> {
match (lhs_type, rhs_type, op) {
// if an interval is being added/subtracted from a date/timestamp, return the date/timestamp data type
(lhs, rhs, _) if is_interval(lhs) && (is_date(rhs) || is_timestamp(rhs)) => {
- Ok(Some(rhs.clone()))
+ Some(rhs.clone())
}
(lhs, rhs, _) if is_interval(rhs) && (is_date(lhs) || is_timestamp(lhs)) => {
- Ok(Some(lhs.clone()))
+ Some(lhs.clone())
}
// if two timestamps are being subtracted, check their time units and return the corresponding interval data type
(lhs, rhs, Operator::Minus) if is_timestamp(lhs) && is_timestamp(rhs) => {
handle_timestamp_minus(lhs, rhs)
}
// if two intervals are being added/subtracted, check their interval units and return the corresponding interval data type
- (lhs, rhs, _) if is_interval(lhs) && is_interval(rhs) => handle_interval_addition(lhs, rhs),
+ (lhs, rhs, _) if is_interval(lhs) && is_interval(rhs) => {
+ handle_interval_addition(lhs, rhs)
+ }
// if two date/timestamp are being added/subtracted, return an error indicating that the operation is not supported
- (lhs, rhs, _) if (is_date(lhs) || is_timestamp(lhs)) && (is_date(rhs) || is_timestamp(rhs)) => {
- Err(DataFusionError::Plan(format!(
- "{lhs_type:?} {rhs_type:?} is an unsupported operation. addition/subtraction on dates/timestamps only supported with interval types"
- )))
+ (lhs, rhs, Operator::Minus)
+ if (is_date(lhs) || is_timestamp(lhs))
+ && (is_date(rhs) || is_timestamp(rhs)) =>
+ {
+ // TODO: support Minus
Review Comment:
Yes, these code exist problem, I will fix it in other PR.
In fact, we should allow datetime - datetime
--
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
[GitHub] [arrow-datafusion] jackwener merged pull request #5932: just match for BinaryExpr Date/Time +/- Interval
Posted by "jackwener (via GitHub)" <gi...@apache.org>.
jackwener merged PR #5932:
URL: https://github.com/apache/arrow-datafusion/pull/5932
--
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
[GitHub] [arrow-datafusion] jackwener commented on a diff in pull request #5932: just match for BinaryExpr Date/Time +/- Interval
Posted by "jackwener (via GitHub)" <gi...@apache.org>.
jackwener commented on code in PR #5932:
URL: https://github.com/apache/arrow-datafusion/pull/5932#discussion_r1161322312
##########
datafusion/expr/src/type_coercion/binary.rs:
##########
@@ -217,57 +217,61 @@ pub fn temporal_add_sub_coercion(
lhs_type: &DataType,
rhs_type: &DataType,
op: &Operator,
-) -> Result<Option<DataType>> {
+) -> Option<DataType> {
match (lhs_type, rhs_type, op) {
// if an interval is being added/subtracted from a date/timestamp, return the date/timestamp data type
(lhs, rhs, _) if is_interval(lhs) && (is_date(rhs) || is_timestamp(rhs)) => {
- Ok(Some(rhs.clone()))
+ Some(rhs.clone())
}
(lhs, rhs, _) if is_interval(rhs) && (is_date(lhs) || is_timestamp(lhs)) => {
- Ok(Some(lhs.clone()))
+ Some(lhs.clone())
}
// if two timestamps are being subtracted, check their time units and return the corresponding interval data type
(lhs, rhs, Operator::Minus) if is_timestamp(lhs) && is_timestamp(rhs) => {
handle_timestamp_minus(lhs, rhs)
}
// if two intervals are being added/subtracted, check their interval units and return the corresponding interval data type
- (lhs, rhs, _) if is_interval(lhs) && is_interval(rhs) => handle_interval_addition(lhs, rhs),
+ (lhs, rhs, _) if is_interval(lhs) && is_interval(rhs) => {
+ handle_interval_addition(lhs, rhs)
+ }
// if two date/timestamp are being added/subtracted, return an error indicating that the operation is not supported
- (lhs, rhs, _) if (is_date(lhs) || is_timestamp(lhs)) && (is_date(rhs) || is_timestamp(rhs)) => {
- Err(DataFusionError::Plan(format!(
- "{lhs_type:?} {rhs_type:?} is an unsupported operation. addition/subtraction on dates/timestamps only supported with interval types"
- )))
+ (lhs, rhs, Operator::Minus)
+ if (is_date(lhs) || is_timestamp(lhs))
+ && (is_date(rhs) || is_timestamp(rhs)) =>
+ {
+ // TODO: support Minus
Review Comment:
None will be convert to Err outside.
Here use None is right. If here return Err, other None also need to be Err
--
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
[GitHub] [arrow-datafusion] waynexia commented on a diff in pull request #5932: just match for BinaryExpr Date/Time +/- Interval
Posted by "waynexia (via GitHub)" <gi...@apache.org>.
waynexia commented on code in PR #5932:
URL: https://github.com/apache/arrow-datafusion/pull/5932#discussion_r1162269728
##########
datafusion/optimizer/src/analyzer/type_coercion.rs:
##########
@@ -242,20 +242,19 @@ impl TreeNodeRewriter for TypeCoercionRewriter {
op,
ref right,
}) => {
+ // this is a workaround for https://github.com/apache/arrow-datafusion/issues/3419
let left_type = left.get_type(&self.schema)?;
let right_type = right.get_type(&self.schema)?;
match (&left_type, &right_type) {
+ // Handle some case about Interval.
(
DataType::Date32 | DataType::Date64 | DataType::Timestamp(_, _),
&DataType::Interval(_),
- )
- | (
+ ) if matches!(op, Operator::Plus | Operator::Minus) => Ok(expr),
+ (
&DataType::Interval(_),
DataType::Date32 | DataType::Date64 | DataType::Timestamp(_, _),
- ) => {
- // this is a workaround for https://github.com/apache/arrow-datafusion/issues/3419
- Ok(expr.clone())
- }
+ ) if matches!(op, Operator::Plus) => Ok(expr),
Review Comment:
👍 good catch
##########
datafusion/expr/src/type_coercion/binary.rs:
##########
@@ -276,18 +280,16 @@ fn handle_timestamp_minus(lhs: &DataType, rhs: &DataType) -> Result<Option<DataT
| (
DataType::Timestamp(TimeUnit::Millisecond, _),
DataType::Timestamp(TimeUnit::Millisecond, _),
- ) => Ok(Some(DataType::Interval(IntervalUnit::DayTime))),
+ ) => Some(DataType::Interval(IntervalUnit::DayTime)),
(
DataType::Timestamp(TimeUnit::Microsecond, _),
DataType::Timestamp(TimeUnit::Microsecond, _),
)
| (
DataType::Timestamp(TimeUnit::Nanosecond, _),
DataType::Timestamp(TimeUnit::Nanosecond, _),
- ) => Ok(Some(DataType::Interval(IntervalUnit::MonthDayNano))),
- (_, _) => Err(DataFusionError::Plan(
- "The timestamps have different types".to_string(),
- )),
+ ) => Some(DataType::Interval(IntervalUnit::MonthDayNano)),
+ (_, _) => None,
Review Comment:
To my understanding this is only "not supported yet", right? Or did I miss something as the function comment says this is an invalid case
--
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
[GitHub] [arrow-datafusion] comphead commented on a diff in pull request #5932: just match for BinaryExpr Date/Time +/- Interval
Posted by "comphead (via GitHub)" <gi...@apache.org>.
comphead commented on code in PR #5932:
URL: https://github.com/apache/arrow-datafusion/pull/5932#discussion_r1161315484
##########
datafusion/expr/src/type_coercion/binary.rs:
##########
@@ -217,57 +217,61 @@ pub fn temporal_add_sub_coercion(
lhs_type: &DataType,
rhs_type: &DataType,
op: &Operator,
-) -> Result<Option<DataType>> {
+) -> Option<DataType> {
match (lhs_type, rhs_type, op) {
// if an interval is being added/subtracted from a date/timestamp, return the date/timestamp data type
(lhs, rhs, _) if is_interval(lhs) && (is_date(rhs) || is_timestamp(rhs)) => {
- Ok(Some(rhs.clone()))
+ Some(rhs.clone())
}
(lhs, rhs, _) if is_interval(rhs) && (is_date(lhs) || is_timestamp(lhs)) => {
- Ok(Some(lhs.clone()))
+ Some(lhs.clone())
}
// if two timestamps are being subtracted, check their time units and return the corresponding interval data type
(lhs, rhs, Operator::Minus) if is_timestamp(lhs) && is_timestamp(rhs) => {
handle_timestamp_minus(lhs, rhs)
}
// if two intervals are being added/subtracted, check their interval units and return the corresponding interval data type
- (lhs, rhs, _) if is_interval(lhs) && is_interval(rhs) => handle_interval_addition(lhs, rhs),
+ (lhs, rhs, _) if is_interval(lhs) && is_interval(rhs) => {
+ handle_interval_addition(lhs, rhs)
+ }
// if two date/timestamp are being added/subtracted, return an error indicating that the operation is not supported
- (lhs, rhs, _) if (is_date(lhs) || is_timestamp(lhs)) && (is_date(rhs) || is_timestamp(rhs)) => {
- Err(DataFusionError::Plan(format!(
- "{lhs_type:?} {rhs_type:?} is an unsupported operation. addition/subtraction on dates/timestamps only supported with interval types"
- )))
+ (lhs, rhs, Operator::Minus)
+ if (is_date(lhs) || is_timestamp(lhs))
+ && (is_date(rhs) || is_timestamp(rhs)) =>
+ {
+ // TODO: support Minus
Review Comment:
This None might be misleading if Minus called? Probably we can return `Err` on the `temporal_add_sub_coercion` caller side if Minus called?
--
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