apache / apache/datafusion

Public API `ScalarUDFImpl.return_type` returns internal error in some cases

Open
#13,716 1 comment 0 reactions 0 assignees View on GitHub
bug
Dominant language
Rust
Stars
9.3k
Forks
2.4k
Avg merge
3d 7h
Merged PRs (30d)
344

Description

### Describe the bug

I am trying to upgrade the version of DataFusion that Comet uses. Comet currently relies on `ScalarUDFImpl.return_type` to get the return type of a scalar UDF. This now returns an internal error when called for `DatePartFunc`.

```rust
fn return_type(&self, _arg_types: &[DataType]) -> Result {
internal_err!("return_type_from_exprs shoud be called instead")
}
```

Should we deprecate this function if it is no longer the correct approach for determining UDF return types? It looks like `return_type_from_exprs` should now be used instead?

### To Reproduce

_No response_

### Expected behavior

_No response_

### Additional context

_No response_

Contributor guide

Open the contributing guide

Research direction

Review the public ScalarUDFImpl.return_type API and the DatePartFunc implementation, then compare their behavior with return_type_from_exprs. Confirm which method callers should use and whether the existing API needs deprecation or another compatibility change. Done means the intended public return-type path is established and the DatePartFunc internal error is addressed or clearly documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
api
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.