apache / apache/datafusion

Simplify the returned type in `TypeSignature::get_possible_types`

Open
#13,371 5 comments 2 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?

`get_possible_types` returns `Vec>` and convert to string for information schema.

Can we instead return the type define in each function as part of the documentation and return that instead?

We add return type and argument type in `Documentation` struct.

```rust
pub struct Documentation {
// arg name, arg type, description
pub arguments: Option,
pub return_type: String,
}

pub struct ArgumentDescription {
name: String,
type: String,
description: String,
}
```

For example, if one function signature and return type is `func(string, int) -> int`.

Instead of returning bunch of possible DataType combination like (Utf8, Int64), (Utf8View, Int64), (Utf8, Int32) ....

We can return `(string, int)` and `int` for simplicity

@goldmedal @Omega359 What do you think?

### Describe the solution you'd like

_No response_

### Describe alternatives you've considered

_No response_

### Additional context

In postgres, they have data type for argument and return type too. And in more general term like numeric, text, int ...

The overall idea is I want the simple argument type and return type defined in documentation and take this information for information schema.

Screenshot 2024-11-12 at 12 00 03 PM

Contributor guide

Open the contributing guide

Research direction

Start by tracing TypeSignature::get_possible_types and how its Vec> result is converted for the information schema. Review the proposed Documentation, ArgumentDescription, and return_type fields; done would mean the information schema uses the documented simple argument and return types instead of possible DataType combinations.

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
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.