Skip to content

GetAllTypes() any-expansion set is out of sync with the types the producer emits #227

Description

@nielspardon

Follow-up from the review on #225.

SubstraitCustomFunctions::GetAllTypes() is the set of concrete Substrait type kinds an any/any1/unknown argument is expanded over when pre-building the overload maps. For an any-typed function to resolve, the argument type must be both (a) emitted by DuckToSubstraitType and (b) present in GetAllTypes().

Comparing the current list against the kinds the producer actually emits, it is inconsistent in both directions:

Dead entries (in GetAllTypes(), but the producer never emits them, so their any-overloads can never match):

  • varchar — DuckDB VARCHAR → substrait string
  • fixed_binary — DuckDB BLOB → substrait binary
  • interval_year — DuckDB INTERVAL → substrait interval_day

Missing (the producer emits them, but they are absent — so any-typed functions like equal on these arguments fall through to native, losing the extension URN and the compound signature name):

  • list, map, struct, user_defined

Suggested fix

Reconcile GetAllTypes() with the kinds DuckToSubstraitType can produce: drop the three dead entries and add list/map/struct.

user_defined needs extra care: its Substrait short name is u!<name>, but the protobuf Type.kind field name (user_defined) does not carry the type name, so it cannot be turned into a correct signature token from the kind alone (emitting ...:user_defined would be spec-wrong). It needs the user-defined type name threaded through, not just a list entry.

Notes

🤖 Generated with AI

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions