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

[GitHub] [arrow-datafusion] viirya opened a new pull request, #6269: Cast binary numerical operators result between array and scalar to primitive array

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

   # 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 #6243.
   
   # 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] alamb commented on pull request #6269: Fix inconsistent array type for binary numerical operators result between array and scalar

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

   I agree then that this solution makes sense


-- 
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 #6269: Fix inconsistent array type for binary numerical operators result between array and scalar

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

   > Yeah, I guess I was thinking it would nice to avoid the unpacking of the dictionary result into a primitive array (when possible)
   
   I meant, for mathematics numerical kernels (e.g. add, minus etc.), the result of operation between two dictionary arrays is primitive array. We don't unpack dictionary array into primitive array. This is why the coercion rule specifies the result type of such op as primitive type instead of dictionary of it.
   
   But for such op between dictionary and a scalar, the result is dictionary array as for such op it can simply apply on dictionary values which is not the same for above case (dictionary and dictionary). So the inconsistency (primitive for dictionary/dictionary and dictionary for dictionary/scalar) leads to the bug we saw.
   
   We can either changing primitive result of op on dictionary/dictionary to dictionary, or changing dictionary result of op on dictionary/scalar to primitive. This takes the later one as a fix. One reason is that this is simply to apply to fix the issue now. Another reason is that I'm not sure packing op result of dictionary/dictionary as dictionary making sense. It is doable but considering dictionary encoding during mathematics numerical op, it might be introducing performance penalty. I'll find some time trying that.
   
   
   
   


-- 
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 #6269: Fix inconsistent array type for binary numerical operators result between array and scalar

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

   > For mathematics numerical kernels, the returned type of two dictionary input arrays is primitive array. So for mathematics_numerical_coercion, this looks still correct.
   
   Yeah, I guess I was thinking it would nice to avoid the unpacking of the dictionary result into a primitive array (when possible)


-- 
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 merged pull request #6269: Fix inconsistent array type for binary numerical operators result between array and scalar

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


-- 
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 #6269: Fix inconsistent array type for binary numerical operators result between array and scalar

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

   Thanks @alamb. I will find some time looking at the possibility to packing primitive result of math kernels on dictionary/dictionary as dictionary.


-- 
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 #6269: Fix inconsistent array type for binary numerical operators result between array and scalar

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

   Thank you @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] viirya commented on pull request #6269: Fix inconsistent array type for binary numerical operators result between array and scalar

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

   > Now that some of the kernels actually support dictionary encoded arrays natively, I wonder if it would be possible to maintain the dictionary encoding as part of the coercion rules (rather than coercing the output to a primitive type)?
   
   For mathematics numerical kernels, the returned type of two dictionary input arrays is primitive array. So for `mathematics_numerical_coercion`, this looks still correct.
   
   


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