You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/10/30 22:44:45 UTC

[GitHub] [arrow-datafusion] viirya opened a new pull request, #4038: Fix Decimal and Floating type coerce rule

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

   # 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 #4035.
   
   # 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.  
   -->
   
   Currently coerce rule coerces floating types to Decimal type. It doesn't look correct.
   Floating types are treated as 
   
   # 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 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] viirya commented on pull request #4038: Fix Decimal and Floating type coerce rule

Posted by GitBox <gi...@apache.org>.
viirya commented on PR #4038:
URL: https://github.com/apache/arrow-datafusion/pull/4038#issuecomment-1297239132

   Thanks @andygrove @Dandandan 


-- 
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] Dandandan merged pull request #4038: Fix Decimal and Floating type coerce rule

Posted by GitBox <gi...@apache.org>.
Dandandan merged PR #4038:
URL: https://github.com/apache/arrow-datafusion/pull/4038


-- 
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] ursabot commented on pull request #4038: Fix Decimal and Floating type coerce rule

Posted by GitBox <gi...@apache.org>.
ursabot commented on PR #4038:
URL: https://github.com/apache/arrow-datafusion/pull/4038#issuecomment-1297238247

   Benchmark runs are scheduled for baseline = a1c1cd21a27c9f3faae6a59f23feeb99c63fa134 and contender = 5cf090a13391501c0ce7707ac7a1e50e18517b79. 5cf090a13391501c0ce7707ac7a1e50e18517b79 is a master commit associated with this PR. Results will be available as each benchmark for each run completes.
   Conbench compare runs links:
   [Skipped :warning: Benchmarking of arrow-datafusion-commits is not supported on ec2-t3-xlarge-us-east-2] [ec2-t3-xlarge-us-east-2](https://conbench.ursa.dev/compare/runs/6baf1832f5b2435e874b36500b2dfd1a...c1814330455449dc9ea1a01f93daff8f/)
   [Skipped :warning: Benchmarking of arrow-datafusion-commits is not supported on test-mac-arm] [test-mac-arm](https://conbench.ursa.dev/compare/runs/017e12c6419441b98ce3c89002ae142d...013af9f0c01045f286ca5a1f9e930f10/)
   [Skipped :warning: Benchmarking of arrow-datafusion-commits is not supported on ursa-i9-9960x] [ursa-i9-9960x](https://conbench.ursa.dev/compare/runs/c51c896a8f4e49f2b701acda411bf562...f9860d6b5f1247c396e48b0c4b361fbe/)
   [Skipped :warning: Benchmarking of arrow-datafusion-commits is not supported on ursa-thinkcentre-m75q] [ursa-thinkcentre-m75q](https://conbench.ursa.dev/compare/runs/16297724c56c4668846b5b0b6eaf338a...3c3fcb81606146ab9f8958d97b6bf934/)
   Buildkite builds:
   Supported benchmarks:
   ec2-t3-xlarge-us-east-2: Supported benchmark langs: Python, R. Runs only benchmarks with cloud = True
   test-mac-arm: Supported benchmark langs: C++, Python, R
   ursa-i9-9960x: Supported benchmark langs: Python, R, JavaScript
   ursa-thinkcentre-m75q: Supported benchmark langs: C++, Java
   


-- 
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] andygrove commented on a diff in pull request #4038: Fix Decimal and Floating type coerce rule

Posted by GitBox <gi...@apache.org>.
andygrove commented on code in PR #4038:
URL: https://github.com/apache/arrow-datafusion/pull/4038#discussion_r1009522458


##########
datafusion/expr/src/type_coercion/binary.rs:
##########
@@ -333,6 +333,12 @@ fn mathematics_numerical_coercion(
         (Null, dec_type @ Decimal128(_, _)) | (dec_type @ Decimal128(_, _), Null) => {
             Some(dec_type.clone())
         }
+        (Decimal128(_, _), Float32 | Float64) => {
+            Some(Float64)
+        }
+        (Float32 | Float64, Decimal128(_, _)) => {
+            Some(Float64)
+        }

Review Comment:
   I think we need to add the same in `comparison_binary_numeric_coercion` and that helps towards q6



-- 
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] liukun4515 commented on a diff in pull request #4038: Fix Decimal and Floating type coerce rule

Posted by GitBox <gi...@apache.org>.
liukun4515 commented on code in PR #4038:
URL: https://github.com/apache/arrow-datafusion/pull/4038#discussion_r1011451716


##########
datafusion/expr/src/type_coercion/binary.rs:
##########
@@ -333,6 +333,12 @@ fn mathematics_numerical_coercion(
         (Null, dec_type @ Decimal128(_, _)) | (dec_type @ Decimal128(_, _), Null) => {
             Some(dec_type.clone())
         }
+        (Decimal128(_, _), Float32 | Float64) => {
+            Some(Float64)
+        }
+        (Float32 | Float64, Decimal128(_, _)) => {
+            Some(Float64)
+        }

Review Comment:
   > I think we need to add the same in `comparison_binary_numeric_coercion` and that helps towards q6
   
   the rule between arithmetic op and logical op may be different.



-- 
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] viirya commented on a diff in pull request #4038: Fix Decimal and Floating type coerce rule

Posted by GitBox <gi...@apache.org>.
viirya commented on code in PR #4038:
URL: https://github.com/apache/arrow-datafusion/pull/4038#discussion_r1008939230


##########
datafusion/expr/src/type_coercion/binary.rs:
##########
@@ -333,6 +333,12 @@ fn mathematics_numerical_coercion(
         (Null, dec_type @ Decimal128(_, _)) | (dec_type @ Decimal128(_, _), Null) => {
             Some(dec_type.clone())
         }
+        (Decimal128(_, _), Float32 | Float64) => {
+            Some(Float64)
+        }
+        (Float32 | Float64, Decimal128(_, _)) => {
+            Some(Float64)
+        }

Review Comment:
   Follow Spark's type coercision rule `DecimalPrecision`.



-- 
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] viirya commented on a diff in pull request #4038: Fix Decimal and Floating type coerce rule

Posted by GitBox <gi...@apache.org>.
viirya commented on code in PR #4038:
URL: https://github.com/apache/arrow-datafusion/pull/4038#discussion_r1008939230


##########
datafusion/expr/src/type_coercion/binary.rs:
##########
@@ -333,6 +333,12 @@ fn mathematics_numerical_coercion(
         (Null, dec_type @ Decimal128(_, _)) | (dec_type @ Decimal128(_, _), Null) => {
             Some(dec_type.clone())
         }
+        (Decimal128(_, _), Float32 | Float64) => {
+            Some(Float64)
+        }
+        (Float32 | Float64, Decimal128(_, _)) => {
+            Some(Float64)
+        }

Review Comment:
   Follow Spark's decimal type coercision rule.



-- 
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] Dandandan commented on pull request #4038: Fix Decimal and Floating type coerce rule

Posted by GitBox <gi...@apache.org>.
Dandandan commented on PR #4038:
URL: https://github.com/apache/arrow-datafusion/pull/4038#issuecomment-1297233062

   Thanks @viirya 


-- 
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] tustvold commented on pull request #4038: Fix Decimal and Floating type coerce rule

Posted by GitBox <gi...@apache.org>.
tustvold commented on PR #4038:
URL: https://github.com/apache/arrow-datafusion/pull/4038#issuecomment-1367220675

   This appears to have also fixed #3437 and #3791


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