Skip to content

chore(Data/SQLParser): port the open hyrise/sql-parser pull requests #5605 - #5608

Merged
aleks-f merged 3 commits into
mainfrom
5605-sqlparser-upstream-prs
Oct 29, 2026
Merged

aleks-f merged 3 commits into
mainfrom
5605-sqlparser-upstream-prs

Conversation

@aleks-f

@aleks-f aleks-f commented Oct 29, 2026

Copy link
Copy Markdown
Member

Closes #5605

The vendored SQL parser descends from hyrise/sql-parser, whose open pull requests are not merged upstream any more. This ports those that close parsing gaps of the vendored copy, adapted to its grammar, and fixes what the review of the port turned up.

Tests: each change has tests in the upstream suite, which also runs under valgrind and the grammar conflict check, and in Data's SQLParserTest.

Follow-ups: none. hyrise/sql-parser#234 is already covered, and hyrise/sql-parser#244 does not apply.

…5605

Ports hyrise/sql-parser#260 and hyrise/sql-parser#255 (interval types and field range literals; TIME and TIMESTAMP literals; CURRENT_DATE, CURRENT_TIME and CURRENT_TIMESTAMP), hyrise/sql-parser#265 (a three-part column reference fills the schema) and hyrise/sql-parser#248 (parenthesized query expressions in set operations, subqueries, IN, EXISTS and INSERT), adapted to the vendored grammar.

Also: clauses and statements discarded by a parse error are released, CREATE INDEX keeps the schema of a qualified table, TOP keeps its row count with OFFSET alone or LIMIT ALL, the ColumnType operators are exported, and the parser objects are rebuilt when a header changes.
@aleks-f aleks-f added this to the Release 2.0 milestone Oct 29, 2026
@aleks-f
aleks-f requested a balanced review from Copilot October 29, 2026 04:34

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Set-operation chaining incorrectly changes INTERSECT precedence after a parenthesized SELECT, and the new interval overload makes previously valid zero-duration API calls ambiguous.

2 open issues
What changed in this PR

Ports upstream SQL parser improvements into POCO's vendored parser to address #5605, extending supported SQL syntax and improving parse-error cleanup.

Changes:

  • Adds interval types and ranges, datetime literals, and structured schema qualifiers.
  • Expands parenthesized query support across set operations, subqueries, and INSERT.
  • Fixes clause ownership, TOP row-count handling, and header-triggered rebuilds; adds regression coverage.
File Description
Data/​testsuite/​src/​SQLParserTest.h Declares new parser regression tests.
Data/​testsuite/​src/​SQLParserTest.cpp Adds POCO integration coverage for parser changes.
Data/​testsuite/​src/​DataTest.cpp Replaces a non-ASCII dash in a comment.
Data/​SQLParser/​test/​sql_tests.cpp Tests interval types, datetime values, and qualified names.
Data/​SQLParser/​test/​select_tests.cpp Tests query grouping, qualifiers, literals, and TOP handling.
Data/​SQLParser/​test/​queries/​queries-good.sql Expands accepted SQL examples and corrects the header comment.
Data/​SQLParser/​test/​queries/​queries-bad.sql Adds rejected syntax and cleanup cases.
Data/​SQLParser/​src/​util/​sqlhelper.cpp Prints new literal types and schema qualifiers.
Data/​SQLParser/​src/​SQLParser.cpp Initializes tokenizer location state.
Data/​SQLParser/​src/​sql/​UpdateStatement.h Declares an exported, owning update-clause destructor.
Data/​SQLParser/​src/​sql/​statements.cpp Implements clause cleanup and interval type operations.
Data/​SQLParser/​src/​sql/​SelectStatement.h Declares locking-clause cleanup.
Data/​SQLParser/​src/​sql/​Expr.h Extends expression types, metadata, and factories.
Data/​SQLParser/​src/​sql/​Expr.cpp Implements new literal and qualified-column factories.
Data/​SQLParser/​src/​sql/​ColumnType.h Adds interval fields and exports type operators.
Data/​SQLParser/​src/​parser/​sql_keywords.txt Lists interval and current-datetime keywords.
Data/​SQLParser/​src/​parser/​flex_lexer.l Recognizes current-datetime keywords.
Data/​SQLParser/​src/​parser/​flex_lexer.h Updates generated lexer source-location metadata.
Data/​SQLParser/​src/​parser/​flex_lexer.cpp Updates generated lexer tables and keyword actions.
Data/​SQLParser/​src/​parser/​bison_parser.y Extends grammar, query construction, and error cleanup.
Data/​SQLParser/​src/​parser/​bison_parser.h Updates generated tokens and query-body state.
Data/​SQLParser/​Makefile Rebuilds parser objects when headers change.

Review effort: Balanced

Comment thread Data/SQLParser/src/parser/bison_parser.y Outdated
Comment thread Data/SQLParser/src/sql/Expr.h Outdated
…terval range factory has its own name #5605

INTERSECT binds tighter than UNION and EXCEPT, which apply from left to right, and parentheses around a single SELECT change nothing; unparenthesized chains nested to the right, so EXCEPT chains and INTERSECT before UNION grouped unlike SQL. makeIntervalRangeLiteral takes the string value of a field range, which keeps makeIntervalLiteral(0, unit) unambiguous.
@aleks-f
aleks-f merged commit 3515d60 into main Oct 29, 2026
58 checks passed
@aleks-f
aleks-f deleted the 5605-sqlparser-upstream-prs branch October 29, 2026 17:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SQLParser: port the open upstream hyrise/sql-parser pull requests

2 participants