apache / apache/datafusion

[substrait] Add support for enum arguments

Open
#12,493 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Rust
Stars
9.3k
Forks
2.4k
Avg merge
3d 7h
Merged PRs (30d)
344

Description

### Is your feature request related to a problem or challenge?

Substrait has [3 different types](https://substrait.io/expressions/scalar_functions/#argument-types) of arguments for functions. One of these types is enumerated arguments, which support a fixed set of declared values as possible inputs.

The [Substrait TPCH plans for queries 7, 8, and 9 ](https://github.com/apache/datafusion/tree/main/datafusion/substrait/tests/testdata/tpch_substrait_plans) cannot be read into DataFusion because they contain functions with enum arguments.

TPHC plan 7 for example contains an invocation of the [extract](https://github.com/substrait-io/substrait/blob/bc4d6fb9bc0435c3db24172566c343e119fc50a9/extensions/functions_datetime.yaml#L107-L113) function, whose first argument is an enum used to indicate what component of the date to extract.

### Describe the solution you'd like

It should be possible to process plans containing Substrait enum arguments.

### Describe alternatives you've considered

_No response_

### Additional context

_No response_

Contributor guide

Open the contributing guide

Research direction

Start with the Substrait argument-types documentation and the linked datetime function definition, then inspect datafusion/substrait/tests/testdata/tpch_substrait_plans for the enum arguments in TPCH plans 7, 8, and 9. Done means DataFusion can read and process plans containing Substrait enum arguments, including the extract example.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.