fix: make table function arg coercion non-fatal, add raw_exprs accessor#23059
Open
sandy-sachin7 wants to merge 1 commit into
Open
Conversation
Closes apache#22952 Changes: - Make type coercion and simplification of table function arguments non-fatal: if coercion or simplification fails for a particular argument, fall back to the original raw expression instead of propagating the error. - Add raw_exprs() accessor to TableFunctionArgs so that table function implementations can access the original, unprocessed arguments. - Add new_with_raw() constructor for TableFunctionArgs when separate processed and raw expressions need to be passed.
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.
Which issue does this PR close?
Rationale for this change
The type coercion and simplification applied to table function arguments in
get_table_function_sourcecan fail for custom table function expressions (e.g.,tbf(a='x', b='x')), breaking user-facing SQL. The error propagates before the table function implementation ever sees the arguments.What changes are included in this PR?
Non-fatal coercion/simplification (
session_state.rs): Ifcoerce()orsimplify()fails for a particular argument, fall back to the original raw expression instead of propagating the error. Existing built-in functions continue to get successfully coerced/simplified arguments as before.raw_exprs()accessor (table.rs): Added toTableFunctionArgsso that table function implementations can access the original, unprocessed arguments when needed. Addednew_with_raw()constructor for this purpose.Are these changes tested?
Covered by existing tests:
test_udtf_type_coercion- type coercion still works when it can succeedtest_simple_read_csv_udtf- basic UDTF functionality intactgenerate_seriestests - simplification path still workstype_coercionsqllogictests passAre there any user-facing changes?
Yes - custom table function implementations can now use
args.raw_exprs()to access original expression arguments. No breaking changes to existing APIs.