fix(curation): remove redundant wrapper parse in reject_non_single_select - #542
Open
amansingh-121 wants to merge 1 commit into
Open
amansingh-121 wants to merge 1 commit into
amansingh-121 wants to merge 1 commit into
Conversation
Contributor
|
Please stop taking Not reviewing this. |
This was referenced Sep 18, 2026
Closed
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.
Closes #481.
Removes the redundant third parsing step in
reject_non_single_select(src/hflow/curation.py). The function already rejects multi-statement inputs and PRAGMA/DESCRIBE/SHOW/SUMMARIZE inputs via DuckDB'sextract_statementscount/type check and the leading-keyword check, respectively. The wrapper parseSELECT * FROM (<sql>)never catches a case that isn't already refused, and it adds a per-query DuckDB parse for no benefit.The wrapper parse was originally added to catch subquery-forbidden leading keywords, but those are already covered by the
_leading_keywordgate, and any SQL that parses standalone as a single SELECT also parses inside the wrapper (or is already rejected by the count/type check). Measurements in the issue confirmed the block is dead: removing it leaves all 9reject_non_single_selecttests green, and a broad shape sweep found no input where the wrapped parse fails while the first two checks pass.Changes
wrapped_inputconstruction and theextract_statements(wrapped_input)try/except.Tests
test_reject_non_single_select*tests pass (9/9).ruff check,ruff format --check, andty checkall pass.Notes
The change is purely a dead-code removal — no new behaviour is introduced, and no existing refusal messages change. The per-query parse cost drops by one DuckDB parse for every curation gate check.