@@ -1050,6 +1050,10 @@ impl<'a> Parser<'a> {
10501050 } , // End of Token::Word
10511051 // array `[1, 2, 3]`
10521052 Token :: LBracket => self . parse_array_expr ( false ) ,
1053+ Token :: AtSign if self . parse_keyword ( Keyword :: SIGMA ) => {
1054+ self . expect_token ( & Token :: Period ) ?;
1055+ Ok ( Expr :: SigmaParameter ( self . parse_identifier ( false ) ?) )
1056+ }
10531057 tok @ Token :: Minus | tok @ Token :: Plus => {
10541058 let op = if tok == Token :: Plus {
10551059 UnaryOperator :: Plus
@@ -7985,6 +7989,7 @@ impl<'a> Parser<'a> {
79857989 match & mut table_and_joins. relation {
79867990 TableFactor :: Derived { alias, .. }
79877991 | TableFactor :: Table { alias, .. }
7992+ | TableFactor :: SigmaElement { alias, .. }
79887993 | TableFactor :: Function { alias, .. }
79897994 | TableFactor :: UNNEST { alias, .. }
79907995 | TableFactor :: JsonTable { alias, .. }
@@ -8062,6 +8067,11 @@ impl<'a> Parser<'a> {
80628067 columns,
80638068 alias,
80648069 } )
8070+ } else if self . parse_sigma_directive ( ) {
8071+ self . expect_token ( & Token :: Period ) ?;
8072+ let element = self . parse_identifier ( true ) ?;
8073+ let alias = self . parse_optional_table_alias ( keywords:: RESERVED_FOR_TABLE_ALIAS ) ?;
8074+ Ok ( TableFactor :: SigmaElement { element, alias } )
80658075 } else {
80668076 let name = self . parse_object_name ( true ) ?;
80678077
@@ -8118,6 +8128,15 @@ impl<'a> Parser<'a> {
81188128 }
81198129 }
81208130
8131+ pub fn parse_sigma_directive ( & mut self ) -> bool {
8132+ self . maybe_parse ( |p| {
8133+ p. expect_token ( & Token :: AtSign ) ?;
8134+ p. expect_keyword ( Keyword :: SIGMA ) ?;
8135+ Ok ( ( ) )
8136+ } )
8137+ . is_some ( )
8138+ }
8139+
81218140 /// Parse a given table version specifier.
81228141 ///
81238142 /// For now it only supports timestamp versioning for BigQuery and MSSQL dialects.
0 commit comments