Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[chore] Revert @sigma table factor #28

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -20,7 +20,7 @@
//! As a matter of fact, most of these keywords are not used at all
//! and could be removed.
//! 3) a `RESERVED_FOR_TABLE_ALIAS` array with keywords reserved in a
//! "table alias" context.

Check failure on line 23 in src/keywords.rs

View workflow job for this annotation

GitHub Actions / lint

doc list item without indentation

Check failure on line 23 in src/keywords.rs

View workflow job for this annotation

GitHub Actions / lint

doc list item without indentation

#[cfg(feature = "serde")]
use serde::{Deserialize, Serialize};
Expand Down Expand Up @@ -655,7 +655,6 @@
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.

Loading