Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Usage of substrait extension types #71

Merged
merged 16 commits into from
Dec 13, 2023
Merged

Conversation

pdet
Copy link
Contributor

@pdet pdet commented Dec 12, 2023

We now verify the custom extensions defined in the extensions folder.

If they exist there, we properly add the extension to our plan and create a function signature in the format:
<function name>:<short_arg_type0>_<short_arg_type1>_..._<short_arg_typeN>

When consuming plans, we disregard this extra information. I guess it might only be useful in the context of executing functions rather than the operator, but I'm not yet certain.

I think the main thing missing is that there are no guarantees that we are not exporting functions that are either native to Substrait or defined in these extension YAML files. This might be something to explore in the future if a system that tries to consume DuckDB Plans actually needs these.

Finally, I've done a lot of fiddling with the auto-generated proto code to get type signatures but did not manage to obtain them. I'm currently getting these signatures by parsing debug info, which is pretty hacky. I will need to find a cleaner way of doing this.

Fixes: #65

As an example, a plan for the query:

select sin(a) from t

where t is:

create table t (a double)

And the sin function, now defined in the Substrait extensions, looks like this:

{
  "extensionUris": [
    {
      "extensionUriAnchor": 1,
      "uri": "https://github.com/substrait-io/substrait/blob/main/extensions/functions_arithmetic.yaml"
    }
  ],
  "extensions": [
    {
      "extensionFunction": {
        "functionAnchor": 1,
        "name": "sin:fp64"
      }
    }
  ],
...

@pdet pdet requested a review from Tishj December 12, 2023 16:51
@pdet pdet merged commit 52ff1ca into substrait-io:main Dec 13, 2023
3 checks passed
@pdet pdet deleted the use_extensions branch August 6, 2024 14:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support (or ignore) scalar function type signatures
1 participant