Repository navigation
Conversation
Areesha-Rizwan412
approved these changes
Nov 29, 2026
Areesha-Rizwan412
left a comment
There was a problem hiding this comment.
Verified this is the follow-on @alamb asked for in #27674 - @2010YOUY01 suggested the exact plan_err! there, and this PR applies it.
Checked at head: plan_err! is already imported and used throughout this file, and the sibling invalid-function path right below (plan_err!("Invalid function '{name}'.")) already returns a plan error, so the no-functions case is now consistent with it. A context with no registered functions is a valid setup, not an internal failure, so DataFusionError::Plan is the right variant here. The updated test assertion matches the Plan display prefix (Error during planning: ) in datafusion/common/src/error.rs.
CI is green. LGTM.
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?
Follow-on to #27674 (per review feedback from @2010YOUY01 and @alamb)
Rationale for this change
Running a
ContextProviderwith no registered functions is a valid configuration, so failing to resolve a SQL function in that context should return aDataFusionError::Plan(plan_err!) rather thanDataFusionError::Internal(internal_err!).What changes are included in this PR?
datafusion/sql/src/expr/function.rs: Returnplan_err!("No functions registered with this context.")instead ofinternal_err!(...)when no functions are registered in the context.datafusion/sql/tests/sql_integration.rs: Update the assertion intest_no_functions_registeredfrom"Internal error: ..."to"Error during planning: ...".What is the testing strategy for this PR?
Yes:
cargo test -p datafusion-sqlcargo clippy -p datafusion-sql --all-targets --no-deps -- -D warningscargo fmt -p datafusion-sql -- --checkAre there any user-facing changes?
Calling a SQL function against a context with no registered functions now returns
DataFusionError::Plan ("Error during planning: No functions registered with this context.")instead ofDataFusionError::Internal.