Skip to content

Add Macros to assist with static dispatch #2635

@tustvold

Description

@tustvold

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

Metadata

Metadata

Assignees

Labels

arrowChanges to the arrow crateenhancementAny new improvement worthy of a entry in the changelog

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions