Skip to content

Commit

Permalink
Revert @sigma table factor
Browse files Browse the repository at this point in the history
  • Loading branch information
ayman-sigma committed Nov 19, 2024
1 parent 9c6ec54 commit 662717c
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 73 deletions.
3 changes: 0 additions & 3 deletions src/ast/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -462,8 +462,6 @@ pub enum Expr {
Identifier(Ident),
/// Multi-part identifier, e.g. `table_alias.column` or `schema.table.col`
CompoundIdentifier(Vec<Ident>),
/// A reference to a Sigma scalar value, e.g. `@sigma.my_parameter`.
SigmaParameter(Ident),
/// Access data nested in a value containing semi-structured data, such as
/// the `VARIANT` type on Snowflake. for example `src:customer[0].name`.
///
Expand Down Expand Up @@ -950,7 +948,6 @@ impl fmt::Display for Expr {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match self {
Expr::Identifier(s) => write!(f, "{s}"),
Expr::SigmaParameter(s) => write!(f, "@sigma.{s}"),
Expr::MapAccess { column, keys } => {
write!(f, "{column}{}", display_separated(keys, ""))
}
Expand Down
12 changes: 0 additions & 12 deletions src/ast/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -916,11 +916,6 @@ pub enum TableFactor {
/// [Partition selection](https://dev.mysql.com/doc/refman/8.0/en/partitioning-selection.html), supported by MySQL.
partitions: Vec<Ident>,
},
/// A reference to an element in a Sigma workbook.
SigmaElement {
element: Ident,
alias: Option<TableAlias>,
},
Derived {
lateral: bool,
subquery: Box<Query>,
Expand Down Expand Up @@ -1317,13 +1312,6 @@ impl fmt::Display for TableFactor {
}
Ok(())
}
TableFactor::SigmaElement { element, alias } => {
write!(f, "@sigma.{element}")?;
if let Some(alias) = alias {
write!(f, " AS {alias}")?;
}
Ok(())
}
TableFactor::Derived {
lateral,
subquery,
Expand Down
1 change: 0 additions & 1 deletion src/keywords.rs
Original file line number Diff line number Diff line change
Expand Up @@ -655,7 +655,6 @@ define_keywords!(
SETTINGS,
SHARE,
SHOW,
SIGMA,
SIMILAR,
SKIP,
SLOW,
Expand Down
19 changes: 0 additions & 19 deletions src/parser/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1152,10 +1152,6 @@ impl<'a> Parser<'a> {
}, // End of Token::Word
// array `[1, 2, 3]`
Token::LBracket => self.parse_array_expr(false),
Token::AtSign if self.parse_keyword(Keyword::SIGMA) => {
self.expect_token(&Token::Period)?;
Ok(Expr::SigmaParameter(self.parse_identifier(false)?))
}
tok @ Token::Minus | tok @ Token::Plus => {
let op = if tok == Token::Plus {
UnaryOperator::Plus
Expand Down Expand Up @@ -9152,7 +9148,6 @@ impl<'a> Parser<'a> {
match &mut table_and_joins.relation {
TableFactor::Derived { alias, .. }
| TableFactor::Table { alias, .. }
| TableFactor::SigmaElement { alias, .. }
| TableFactor::Function { alias, .. }
| TableFactor::UNNEST { alias, .. }
| TableFactor::JsonTable { alias, .. }
Expand Down Expand Up @@ -9267,11 +9262,6 @@ impl<'a> Parser<'a> {
columns,
alias,
})
} else if self.parse_sigma_directive() {
self.expect_token(&Token::Period)?;
let element = self.parse_identifier(true)?;
let alias = self.parse_optional_table_alias(keywords::RESERVED_FOR_TABLE_ALIAS)?;
Ok(TableFactor::SigmaElement { element, alias })
} else {
let name = self.parse_object_name(true)?;

Expand Down Expand Up @@ -9334,15 +9324,6 @@ impl<'a> Parser<'a> {
}
}

pub fn parse_sigma_directive(&mut self) -> bool {
self.maybe_parse(|p| {
p.expect_token(&Token::AtSign)?;
p.expect_keyword(Keyword::SIGMA)?;
Ok(())
})
.is_some()
}

fn parse_match_recognize(&mut self, table: TableFactor) -> Result<TableFactor, ParserError> {
self.expect_token(&Token::LParen)?;

Expand Down
38 changes: 0 additions & 38 deletions tests/sqlparser_sigma.rs

This file was deleted.

0 comments on commit 662717c

Please sign in to comment.