Repository navigation
chore(Data/SQLParser): port the open hyrise/sql-parser pull requests #5605 - #5608
Merged
Merged
Conversation
…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.
Contributor
There was a problem hiding this comment.
🟡 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
…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.
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 #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.