You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "alamb (via GitHub)" <gi...@apache.org> on 2023/06/07 20:11:04 UTC

[GitHub] [arrow-datafusion] alamb commented on a diff in pull request #6578: fix: type coercion support date - date

alamb commented on code in PR #6578:
URL: https://github.com/apache/arrow-datafusion/pull/6578#discussion_r1222103951


##########
datafusion/core/tests/sqllogictests/test_files/dates.slt:
##########
@@ -90,7 +90,7 @@ select i_item_desc from test
 where d3_date > now() + '5 days';
 
 # DATE minus DATE
-query error DataFusion error: Error during planning: Unsupported argument types\. Can not evaluate Date32 \- Date32
+query error DataFusion error: Optimizer rule 'simplify_expressions' failed\ncaused by\nArrow error: Cast error: Cannot perform arithmetic operation between array of type Date32 and array of type Date32

Review Comment:
   I filed https://github.com/apache/arrow-rs/issues/4383 to track arrow kernel support
   
   ```suggestion
   # https://github.com/apache/arrow-rs/issues/4383
   query error DataFusion error: Optimizer rule 'simplify_expressions' failed\ncaused by\nArrow error: Cast error: Cannot perform arithmetic operation between array of type Date32 and array of type Date32
   ```



##########
datafusion/expr/src/type_coercion/binary.rs:
##########
@@ -738,6 +740,8 @@ fn temporal_coercion(lhs_type: &DataType, rhs_type: &DataType) -> Option<DataTyp
         (Interval(YearMonth), Interval(YearMonth)) => Some(Interval(YearMonth)),
         (Interval(DayTime), Interval(DayTime)) => Some(Interval(DayTime)),
         (Interval(_), Interval(_)) => Some(Interval(MonthDayNano)),
+        (Date32, Date32) => Some(Date32),

Review Comment:
   Maybe we should put a generic clause that if `lhs_type == rhs_type` we can return that type?



-- 
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