MCPcopy Create free account
hub / github.com/MaterializeInc/materialize / parse_window_frame

Method parse_window_frame

src/sql-parser/src/parser.rs:903–923  ·  view source on GitHub ↗
(&mut self)

Source from the content-addressed store, hash-verified

901 }
902
903 fn parse_window_frame(&mut self) -> Result<WindowFrame, ParserError> {
904 let units = match self.expect_one_of_keywords(&[ROWS, RANGE, GROUPS])? {
905 ROWS => WindowFrameUnits::Rows,
906 RANGE => WindowFrameUnits::Range,
907 GROUPS => WindowFrameUnits::Groups,
908 _ => unreachable!(),
909 };
910 let (start_bound, end_bound) = if self.parse_keyword(BETWEEN) {
911 let start_bound = self.parse_window_frame_bound()?;
912 self.expect_keyword(AND)?;
913 let end_bound = Some(self.parse_window_frame_bound()?);
914 (start_bound, end_bound)
915 } else {
916 (self.parse_window_frame_bound()?, None)
917 };
918 Ok(WindowFrame {
919 units,
920 start_bound,
921 end_bound,
922 })
923 }
924
925 /// Parse `CURRENT ROW` or `{ <positive number> | UNBOUNDED } { PRECEDING | FOLLOWING }`
926 fn parse_window_frame_bound(&mut self) -> Result<WindowFrameBound, ParserError> {

Callers 1

parse_functionMethod · 0.80

Calls 4

parse_keywordMethod · 0.80
expect_keywordMethod · 0.80

Tested by

no test coverage detected