feat(core)!: derive container return types from nested argument bindings - #1289
Open
alexandrefimov wants to merge 2 commits into
Open
feat(core)!: derive container return types from nested argument bindings#1289alexandrefimov wants to merge 2 commits into
alexandrefimov wants to merge 2 commits into
Conversation
Parameterized list returns currently fail even when their element type is available from the arguments. For filter, sort and transform, type variables inside list and function arguments are also never bound. Bind type and integer parameters recursively through list, map, struct and function arguments, and derive container returns from those bindings. Preserve nested nullability and enforce shared parameter, literal and variadic constraints from [spec v0.102.0](https://github.com/substrait-io/substrait/blob/v0.102.0/site/docs/expressions/scalar_functions.md#nullability-and-any-type-binding). If the available bindings leave a nested element's nullability undetermined, derivation fails. This enables the six Java-side variants in substrait-io#1241: filter, sort, transform, string_split, regexp_string_split and regexp_match_substring_all. quantile remains unsupported because the pinned catalog uses an anonymous any in its return type. It needs [the spec fix](substrait-io/substrait#1193) and a packaging update. Closes substrait-io#1241
Let nested wildcard occurrences determine the variable's nullability while keeping nested-to-nested consistency checks. Cover index_in with nullable list elements and argument-order independence. Add a successful derived-output validation case and check that catalog function arguments require Type.Func.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Parameterized list returns currently fail even when their element type is available from the arguments. For filter, sort and transform, type variables inside list and function arguments are also never bound.
Bind type and integer parameters recursively through list, map, struct and function arguments, and derive container returns from those bindings. Preserve nested nullability and enforce shared parameter, literal and variadic constraints from spec v0.102.0. If the available bindings leave a nested element's nullability undetermined, derivation fails.
The spec table does not cover a wildcard shared by a top-level argument and an unmarked list element. Keep existing calls such as index_in(i32, list<i32?>) valid: the top-level occurrence leaves the variable's nullability open, and the nested occurrence determines it. Two unmarked nested occurrences must still agree on nullability.
This enables the six Java-side variants in #1241: filter, sort, transform, string_split, regexp_string_split and regexp_match_substring_all. quantile remains unsupported because the pinned catalog uses an anonymous any in its return type. It needs the spec fix and a packaging update.
Closes #1241
BREAKING CHANGE: Function.resolveType now checks container argument shapes and shared parameter constraints even when the return type is concrete. Calls that previously derived a type despite invalid arguments can now fail. Pass Type.Func for function arguments and use types that satisfy the declared shapes and parameter constraints.