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 2021/12/18 14:12:14 UTC

[GitHub] [arrow-datafusion] liukun4515 opened a new pull request #1465: support decimal to numeric

liukun4515 opened a new pull request #1465:
URL: https://github.com/apache/arrow-datafusion/pull/1465


   # 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.
   -->
   
   part of #1443
   
    # 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 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] alamb commented on pull request #1465: Tests for support try_cast/cast decimal to numeric

Posted by GitBox <gi...@apache.org>.
alamb commented on pull request #1465:
URL: https://github.com/apache/arrow-datafusion/pull/1465#issuecomment-1013311970


   It appears this PR has some conflicts that need to be resolved now 


-- 
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 edited a comment on pull request #1465: support try_cast/cast decimal to numeric

Posted by GitBox <gi...@apache.org>.
liukun4515 edited a comment on pull request #1465:
URL: https://github.com/apache/arrow-datafusion/pull/1465#issuecomment-1011763570


   It's ready to review.
   PTAL @alamb @houqp 


-- 
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 #1465: Tests for support try_cast/cast decimal to numeric

Posted by GitBox <gi...@apache.org>.
alamb commented on pull request #1465:
URL: https://github.com/apache/arrow-datafusion/pull/1465#issuecomment-1013870434


   Thanks again @liukun4515 


-- 
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 #1465: support try_cast/cast decimal to numeric

Posted by GitBox <gi...@apache.org>.
alamb commented on pull request #1465:
URL: https://github.com/apache/arrow-datafusion/pull/1465#issuecomment-1012438462


   I will try and review this later today but I may not be able to review until tomorow


-- 
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 change in pull request #1465: Tests for support try_cast/cast decimal to numeric

Posted by GitBox <gi...@apache.org>.
alamb commented on a change in pull request #1465:
URL: https://github.com/apache/arrow-datafusion/pull/1465#discussion_r785020888



##########
File path: datafusion/src/physical_plan/expressions/cast.rs
##########
@@ -158,14 +158,66 @@ pub fn cast(
 #[cfg(test)]
 mod tests {
     use super::*;
+    use crate::arrow::array::{DecimalArray, DecimalBuilder};
     use crate::error::Result;
     use crate::physical_plan::expressions::col;
     use arrow::array::{StringArray, Time64NanosecondArray};
     use arrow::{
-        array::{Array, Int32Array, Int64Array, TimestampNanosecondArray, UInt32Array},
+        array::{
+            Array, Float32Array, Float64Array, Int16Array, Int32Array, Int64Array,
+            Int8Array, TimestampNanosecondArray, UInt32Array,
+        },
         datatypes::*,
     };
 
+    // runs an end-to-end test of physical type cast
+    // 1. construct a record batch with a column "a" of type A
+    // 2. construct a physical expression of CAST(a AS B)
+    // 3. evaluate the expression
+    // 4. verify that the resulting expression is of type B
+    // 5. verify that the resulting values are downcastable and correct
+    macro_rules! generic_decimal_to_other_test_cast {

Review comment:
       its unfortunate that this code shares so much with `generic_test_cast` (seems like everything except the creation of the array). I wonder if it would be possible to refactor the validation so that it could be shared. 




-- 
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 pull request #1465: support try_cast/cast decimal to numeric

Posted by GitBox <gi...@apache.org>.
liukun4515 commented on pull request #1465:
URL: https://github.com/apache/arrow-datafusion/pull/1465#issuecomment-1011763570


   It's ready to 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] liukun4515 commented on pull request #1465: Tests for support try_cast/cast decimal to numeric

Posted by GitBox <gi...@apache.org>.
liukun4515 commented on pull request #1465:
URL: https://github.com/apache/arrow-datafusion/pull/1465#issuecomment-1013787425


   > Thanks @liukun4515 -- the only comment I have is it would be nice to reduce some of the duplication if possible, but also a bit of duplication in the tests isn't a horrible thing either.
   > 
   > 👍
   
   I have traced this as a subtask in https://github.com/apache/arrow-datafusion/issues/1443
   


-- 
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 merged pull request #1465: Tests for support try_cast/cast decimal to numeric

Posted by GitBox <gi...@apache.org>.
alamb merged pull request #1465:
URL: https://github.com/apache/arrow-datafusion/pull/1465


   


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