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/06/07 09:01:27 UTC

[GitHub] [arrow-datafusion] jackwener opened a new pull request, #6578: feat: type coercion support date - date

jackwener opened a new pull request, #6578:
URL: https://github.com/apache/arrow-datafusion/pull/6578

   # Which issue does this PR close?
   
   <!--
   We generally require a GitHub issue to be filed for all bug fixes and enhancements and this helps us generate change logs for our releases. You can link an issue to this PR using the GitHub syntax. For example `Closes #123` indicates that this PR will close issue #123.
   -->
   
   Closes #.
   
   # Rationale for this change
   
   <!--
    Why are you proposing this change? If this is already explained clearly in the issue then this section is not needed.
    Explaining clearly why changes are proposed helps reviewers understand your changes and offer better suggestions for fixes.  
   -->
   
   # 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] jackwener commented on pull request #6578: fix: type coercion support date - date

Posted by "jackwener (via GitHub)" <gi...@apache.org>.
jackwener commented on PR #6578:
URL: https://github.com/apache/arrow-datafusion/pull/6578#issuecomment-1580330541

   wait for arrow-rs support `date` - `date`


-- 
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 #6578: fix: type coercion support date - date

Posted by "jackwener (via GitHub)" <gi...@apache.org>.
jackwener commented on code in PR #6578:
URL: https://github.com/apache/arrow-datafusion/pull/6578#discussion_r1222365210


##########
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:
   Yes!



-- 
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 pull request #6578: fix: type coercion support date - date

Posted by "jackwener (via GitHub)" <gi...@apache.org>.
jackwener commented on PR #6578:
URL: https://github.com/apache/arrow-datafusion/pull/6578#issuecomment-1581836703

   Thanks @alamb review


-- 
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 #6578: fix: type coercion support date - date

Posted by "jackwener (via GitHub)" <gi...@apache.org>.
jackwener merged PR #6578:
URL: https://github.com/apache/arrow-datafusion/pull/6578


-- 
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 a diff in pull request #6578: fix: type coercion support date - date

Posted by "alamb (via GitHub)" <gi...@apache.org>.
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


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

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on code in PR #6578:
URL: https://github.com/apache/arrow-datafusion/pull/6578#discussion_r1223071565


##########
datafusion/expr/src/type_coercion/binary.rs:
##########
@@ -733,10 +735,13 @@ fn is_time_with_valid_unit(datatype: DataType) -> bool {
 fn temporal_coercion(lhs_type: &DataType, rhs_type: &DataType) -> Option<DataType> {
     use arrow::datatypes::DataType::*;
     use arrow::datatypes::IntervalUnit::*;
+    use arrow::datatypes::TimeUnit::*;
+
+    if lhs_type == rhs_type {

Review Comment:
   👍 



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