substrait icon indicating copy to clipboard operation
substrait copied to clipboard

Mapping between type variation anchors and definitions

Open jvanstraten opened this issue 2 years ago • 1 comments

Type variation anchor declarations identify a variation using only the extension it's defined in and its name:

https://github.com/substrait-io/substrait/blob/d4cfbe014e9c126ac008094323a2baca9f47c42d/proto/substrait/extensions/extensions.proto#L45-L55

(note that the comment also says it's a type name rather than a variation name, copypaste error I guess)

However, according to https://substrait.io/types/type_variations/:

The name used to reference this type. Should be unique within type variations for this parent type within a simple extension.

So I'm led to conclude that a type variation anchor does not uniquely identify a type variation definition. This is not necessarily broken, but it's extremely annoying to implement, because now I need to introduce some weird concept of "a set of potentially completely unrelated type variation definitions that happen to have the same name" to represent what the declaration refers to. Can we either:

  • change the protos to also require the corresponding type class when declaring a variation (which would also be annoying, because this abstraction does not currently exist in the protos);
  • do the same thing we do for disambiguating function implementations, i.e. require the variation name in the declaration to be of the form <name>:<class>; or
  • expand the name uniqueness constraint to a complete extension rather than scoped by type class

or is this like this for a good reason and I just have to deal with it?

jvanstraten avatar Jul 27 '22 12:07 jvanstraten