Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Macros to assist with static dispatch #2635

Closed
tustvold opened this issue Sep 2, 2022 · 0 comments · Fixed by #2636
Closed

Add Macros to assist with static dispatch #2635

tustvold opened this issue Sep 2, 2022 · 0 comments · Fixed by #2636
Assignees
Labels
arrow Changes to the arrow crate enhancement Any new improvement worthy of a entry in the changelog

Comments

@tustvold
Copy link
Contributor

tustvold commented Sep 2, 2022

Is your feature request related to a problem or challenge? Please describe what you are trying to do.

I frequently find myself writing boilerplate code to downcast ArrayRef to their concrete type based on the DataType. This has a couple of issues:

  • It complicates adding new types, ideally we could add a new primitive type and it would just work
  • It is error prone, it is very easy to accidentally get one of the downcast types wrong and often this can go unnoticed if tests don't happen to exercise that variant in any tests
  • It adds code bloat

Describe the solution you'd like

I would like macros to take the burden of downcasting to the concrete PrimitiveArray or DictionaryArray.

Describe alternatives you've considered

Additional context

@tustvold tustvold added the enhancement Any new improvement worthy of a entry in the changelog label Sep 2, 2022
@tustvold tustvold self-assigned this Sep 2, 2022
tustvold added a commit to tustvold/arrow-rs that referenced this issue Sep 2, 2022
tustvold added a commit to tustvold/arrow-rs that referenced this issue Sep 2, 2022
tustvold added a commit to tustvold/arrow-rs that referenced this issue Sep 2, 2022
tustvold added a commit that referenced this issue Sep 2, 2022
* Add downcast macros (#2635)

* Add Float16 support and trailing commas

* Review feedback
@alamb alamb added the arrow Changes to the arrow crate label Sep 2, 2022
@alamb alamb changed the title Downcast Macros Add Macros to assist with static dispatch Sep 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arrow Changes to the arrow crate enhancement Any new improvement worthy of a entry in the changelog
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants