Skip to content

fix: Set Substrait output types for expressions#20597

Open
wlhjason wants to merge 3 commits intoapache:mainfrom
wlhjason:GH-15831-substrait-output-types
Open

fix: Set Substrait output types for expressions#20597
wlhjason wants to merge 3 commits intoapache:mainfrom
wlhjason:GH-15831-substrait-output-types

Conversation

@wlhjason
Copy link

Which issue does this PR close?

Rationale for this change

The Substrait producer did not set the ScalarFunction output_type when converting binary expressions, which broke consumers relying on the output_type.

What changes are included in this PR?

  • Refactor from_join and from_between to eliminate direct calls to make_binary_op_scalar_func
  • Set the Substrait ScalarFunction output_type when converting several types of DataFusion expressions:
    • Binary expressions (Expr::BinaryExpr)
    • Unary expressions (like Expr::Not)
    • Scalar functions (Expr::ScalarFunction)

There are a few more places where the output_type has not been set, such as from_like and from_in_list, as mentioned in #15831. I've left these out of scope here as fixing them would require more substantial code changes.

Are these changes tested?

Yes, via a new unit test.

Are there any user-facing changes?

No, beyond the Substrait output fix.

@github-actions github-actions bot added the substrait Changes to the substrait crate label Feb 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

substrait Changes to the substrait crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ensure Substrait producer for BinaryExpr includes output_type

1 participant