Description
t-rust-db/db-core's parser::row is a port of this crate's src/parser, and per t-rust-db/db-core ADR 0005 this grammar is the canonical one. The port has since grown a feature this crate lacks (t-rust-db/db-core#74/#67): inline window functions.
ast::Expr::FunctionCall { …, over: Option<WindowDef> }, WindowDef { partition_by: Vec<Expr>, order_by: Vec<OrderingTerm> } with Display
grammar.rs: OVER ( [PARTITION BY expr, …] [ORDER BY term, …] ) parsed; OVER <name>, frame clauses (ROWS/RANGE/GROUPS) and FILTER (…) stay Unsupported with specific messages
- Tests:
window_function_over_partition_and_order_by_roundtrips, window_over_named_window_reference_is_unsupported, window_frame_clause_is_unsupported, window_filter_clause_is_unsupported
Back-port it here so diff -r sqlite-rs/src/parser db-core/src/parser/row returns to zero (t-rust-db/db-core#84 records the rule: grammar changes land here first, or are back-ported in the same window). tests/unit/parser.rs line ~677 currently asserts OVER is unsupported and needs to follow. The codegen/VDBE side is a separate matter (spec 009 V9) — this ticket is grammar + AST + printer only; the planner may keep rejecting over for now.
Complexity
Estimate: small — ~150 lines, all already written in db-core; port verbatim.
Acceptance Criteria
🤖 Analysis by Claude
Description
t-rust-db/db-core's
parser::rowis a port of this crate'ssrc/parser, and per t-rust-db/db-core ADR 0005 this grammar is the canonical one. The port has since grown a feature this crate lacks (t-rust-db/db-core#74/#67): inline window functions.ast::Expr::FunctionCall { …, over: Option<WindowDef> },WindowDef { partition_by: Vec<Expr>, order_by: Vec<OrderingTerm> }withDisplaygrammar.rs:OVER ([PARTITION BY expr, …][ORDER BY term, …])parsed;OVER <name>, frame clauses (ROWS/RANGE/GROUPS) andFILTER (…)stayUnsupportedwith specific messageswindow_function_over_partition_and_order_by_roundtrips,window_over_named_window_reference_is_unsupported,window_frame_clause_is_unsupported,window_filter_clause_is_unsupportedBack-port it here so
diff -r sqlite-rs/src/parser db-core/src/parser/rowreturns to zero (t-rust-db/db-core#84 records the rule: grammar changes land here first, or are back-ported in the same window).tests/unit/parser.rsline ~677 currently assertsOVERis unsupported and needs to follow. The codegen/VDBE side is a separate matter (spec 009 V9) — this ticket is grammar + AST + printer only; the planner may keep rejectingoverfor now.Complexity
Estimate: small — ~150 lines, all already written in db-core; port verbatim.
Acceptance Criteria
src/parser/{ast,grammar,printer}.rsmatch db-core'sparser::rowfor the window-function partstests/unit/parser.rs's OVER expectation updatedmake check-grammar-driftgreen (sqlite.ebnf gains theover_clause/window_defnrules withparse.ycitations, per the grammar convention)🤖 Analysis by Claude