Skip to content

feat(isthmus): observe field reference types - #1080

Open
alexandrefimov wants to merge 1 commit into
substrait-io:mainfrom
alexandrefimov:issue-379-field-reference-type-observer
Open

feat(isthmus): observe field reference types#1080
alexandrefimov wants to merge 1 commit into
substrait-io:mainfrom
alexandrefimov:issue-379-field-reference-type-observer

Conversation

@alexandrefimov

Copy link
Copy Markdown
Contributor

Summary

  • report Calcite input-schema types for root, outer and lambda field references through TypeObserver
  • track input row types and lambda parameter types in the conversion context
  • report a field reference converted with no input in scope as an inference failure instead of failing the conversion

Motivation

#379 lists four conversion points where the Substrait-supplied type and the type Calcite would infer can diverge; scalar functions (#1015) and window functions (#1059) are already observed. Field references are the case the issue singles out as needing access to the underlying input schema, which is what the scope tracking here adds.

Changes

Aggregate, sort and fetch open a conversion scope so their expressions can resolve input field types. Calcite's Aggregate and Sort carry no variablesSet, so an outer reference bound to one of those inputs has nowhere to be declared and is rejected — previously it failed anyway, in requireScope, because no scope existed at all. NamedUpdate applies its filter with the correlation ids resolved while converting the condition and the transformations.

Related to #379.

Report Calcite input-schema types for root, outer and lambda field references
through TypeObserver while keeping RexNode construction unchanged. The
conversion context now tracks input row types and lambda parameter types;
a field reference converted with no input in scope is reported as an
inference failure rather than failing the conversion.

Aggregate, sort and fetch open a conversion scope so their expressions can
resolve input field types. Calcite's Aggregate and Sort carry no
variablesSet, so a correlation bound to one of those inputs is rejected
instead of being silently dropped. Named update now applies its filter with
the correlation ids resolved while converting the condition and the
transformations.
@alexandrefimov
alexandrefimov force-pushed the issue-379-field-reference-type-observer branch from 2fc101f to fc0c796 Compare August 10, 2026 20:06
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.

1 participant