JasonLi-cn commented on code in PR #3110:
URL: https://github.com/apache/arrow-datafusion/pull/3110#discussion_r944359781
##########
datafusion/physical-expr/src/expressions/datetime.rs:
##########
@@ -45,19 +45,21 @@ impl DateIntervalExpr {
input_schema: &Schema,
) -> Result<Self> {
match lhs.data_type(input_schema)? {
- DataType::Date32 | DataType::Date64 => match
rhs.data_type(input_schema)? {
- DataType::Interval(_) => match &op {
- Operator::Plus | Operator::Minus => Ok(Self { lhs, op, rhs
}),
- _ => Err(DataFusionError::Execution(format!(
- "Invalid operator '{}' for DateIntervalExpr",
- op
+ DataType::Date32 | DataType::Date64 | DataType::Timestamp(_, _) =>
{
+ match rhs.data_type(input_schema)? {
+ DataType::Interval(_) => match &op {
Review Comment:
> Thanks @JasonLi-cn - this is a great contribution
>
> The only thing I would like to see are some "integration" level SQL tests
of this feature -- perhaps we could extend the test / add some new tests in
https://github.com/apache/arrow-datafusion/blob/master/datafusion/core/tests/sql/timestamp.rs
>
> cc @avantgardnerio who added the initial version of this functionality in
#2797
Ok, I will add some new tests. :smile:
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]