{{ message }}
Repository navigation
Introduce parser_override_function_t - #19126
Merged
Merged
Conversation
Dtenwolde
marked this pull request as draft
September 24, 2025 12:10
Dtenwolde
marked this pull request as ready for review
September 24, 2025 12:10
Member
Author
duckdb-draftbot
marked this pull request as draft
September 25, 2025 14:09
Dtenwolde
marked this pull request as ready for review
September 25, 2025 15:09
Member
Mytherin
added a commit
that referenced
this pull request
Oct 13, 2025
Follow-up PR to #19181 (I rebased this branch onto the one in the PR so it should include everything) This PR introduces (once again) the `ParseResult` concrete syntax tree structure used by the PEG Transformer. These `ParseResult`s make use of a `ParseResultAllocator` similar to the `MatcherAllocator`. The PR also fixes a (potential) bug related to improperly initializing the `ParserExtension`. I now initialize all those pointers to `nullptr` otherwise they can contain garbage value I found. I reworked the way the PEG Parser is called, it now uses the `ParserExtension` and `parser_override_function_t` introduced in: #19126 It includes the structure of the `PEGTransformer` but does not actually transform any form of statement yet. My plan is to introduce some of the simpler statements, such as `SET`, `RESET`, `PRAGMA` in a follow-up PR. Regarding testing this new transformer I was considering adding a new mode to `ALTERNATIVE_VERIFY` that reruns the query using the `PEGTransformer` and checks for inconsistent results. An issue I see is that the list of incorrect results will be huge until a large part of the transformer is implemented. Should all those tests simply be excluded or can we run subsets of tests and exclude other tests?
krlmlr
added a commit
to krlmlr/duckdb-r-old
that referenced
this pull request
Oct 21, 2025
Introduce `parser_override_function_t` (duckdb/duckdb#19126)
krlmlr
added a commit
to krlmlr/duckdb-r-old
that referenced
this pull request
Nov 1, 2025
Introduce `parser_override_function_t` (duckdb/duckdb#19126)
krlmlr
added a commit
to krlmlr/duckdb-r-old
that referenced
this pull request
Nov 2, 2025
Introduce `parser_override_function_t` (duckdb/duckdb#19126)
krlmlr
added a commit
to krlmlr/duckdb-r-old
that referenced
this pull request
Nov 2, 2025
Introduce `parser_override_function_t` (duckdb/duckdb#19126)
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.

This is a follow-up/improvement over #18937
It adds a new function pointer
parser_override_function_tas part of theParserExtensionwith which extensions can override the current parser. This hook is executed before the current parser and takes as input the entire query string, which can contain multiple statements and returns a vector of (potentially multiple) statement(s). TheParserOverridecan also return either (1) a custom error message which is turned into aParserException(2) Failed parse in which case DuckDB's parser can try to parse & transform the query.In a follow-up PR I will add the PEG parser which will make use of this new hook.