Skip to content

Report error when SessionState::sql_to_expr_with_alias does not consume all input #16811

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

pepijnve
Copy link
Contributor

Which issue does this PR close?

Rationale for this change

When parsing SQL strings into expressions it's preferable to get parse errors when unprocessed input is present rather than silently ignoring this.

What changes are included in this PR?

  • Add DFParser::parse_into_expr which expects to consume the entire input SQL string and reports an error if it did not
  • Adjust SessionState::sql_to_expr_with_alias to use this new function.

Are these changes tested?

Yes, extra test cases have been added to DFParser

Are there any user-facing changes?

This change makes the preconditions for SessionState::sql_to_expr and SessionState::sql_to_expr_with_alias stricter which may cause errors to be reported in code that currently completes successfully.

@github-actions github-actions bot added sql SQL Planner core Core DataFusion crate labels Jul 17, 2025
@pepijnve pepijnve marked this pull request as ready for review July 17, 2025 14:44
Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @pepijnve -- this looks good to me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Core DataFusion crate sql SQL Planner
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SessionState::sql_to_expr does not report unconsumed input
2 participants