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/07/21 20:09:04 UTC

[GitHub] [arrow] edponce commented on pull request #10349: ARROW-12744: [C++][Compute] Add rounding kernel

edponce commented on pull request #10349:
URL: https://github.com/apache/arrow/pull/10349#issuecomment-884465731


   There are 2 round functions (`Round` and `MRound`) and [both use different `Options` but make use of the same `enum RoundMode`](https://github.com/apache/arrow/pull/10349/files#diff-6bc7ecec6a4f7bcefc2511cde3bd809340ad0d94bb8f7cc5f4994063c798f2faR78-R96), therefore I defined [`enum RoundMode` in global space of `api_scalar.h`](https://github.com/apache/arrow/pull/10349/files#diff-6bc7ecec6a4f7bcefc2511cde3bd809340ad0d94bb8f7cc5f4994063c798f2faR58). Based on the recent `FunctionOptions` changes, I added [`EnumTraits<RoundMode>` to `api_scalar.cc`](https://github.com/apache/arrow/pull/10349/files#diff-926d239191ef87c5aa7bbf1ead3e7ad0a7e2d3d099648efda42812e649c2e030R105) along with necessary type and registration code.
   
   For tests, I wanted to use the `values()` method of `EnumTraits` to be able to iterate through the enum values, but I am not sure on how to invoke the `EnumTraits<RoundMode>` since it is not exposed in a header file. My solution was to create an [array (`kRoundModes`) with the enum values in the global space of tests](https://github.com/apache/arrow/pull/10349/files#diff-670d19cdae75caec7c47902285bf28449b6f188eddfb3a366ada22f3d7fe98b5R1403-R1409).
   
   Also, I could not find a way to create the [generator dispatchers without explicitly using the `enum RoundMode` values as template parameters](https://github.com/apache/arrow/pull/10349/files#diff-3eafd7246f6a8c699f10d46e3276852fe44b6853b5517ef10396e561730c09f4R1385-R1410) (I do not think we can do this in C++11 because the value depends on the `ty` loop variable).
   
   @lidavidm @bkietz Any comments or suggestions would be gladly appreciated.


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