apache / apache/datafusion

CreateFunction statement can't represent input or output types that require metadata

Open
#18,235 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?

The create function statement can't express input or output types that need metadata to express them (e.g., UUID). After https://github.com/apache/datafusion/pull/17986 , there is a more clear path towards actually representing those types and there is some code in the SQL planner that drops metadata to support the CreateFunction statement.

https://github.com/apache/datafusion/blob/774b6fee0b8a33b48e28ef35ac5242e80312900b/datafusion/expr/src/logical_plan/ddl.rs#L473-L483

### Describe the solution you'd like

The `DataType` members could be replaced with something that can also support metadata or an extension type.

### Describe alternatives you've considered

_No response_

### Additional context

More places where an extension type can't be represented in a logical plan/statement:

- Issue for updating Cast: https://github.com/apache/datafusion/issues/18060
- Issue for updating Placeholder: https://github.com/apache/datafusion/issues/17862
- Issue for updating ScalarVariable: https://github.com/apache/datafusion/issues/18230

Contributor guide

Open the contributing guide

Research direction

Read datafusion/expr/src/logical_plan/ddl.rs around L473-L483, then review the path opened by PR 17986 and the related planner code that currently drops metadata. Define and implement the CreateFunction representation so input and output types can retain metadata or extension types, and verify that the logical plan or statement preserves them.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
databases
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.