mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-10-15 00:09:02 +00:00
SupportSELECT AS VALUE
and SELECT AS STRUCT
for BigQuery (#1135)
This commit is contained in:
parent
6a9b6f547d
commit
1cf6585649
10 changed files with 89 additions and 10 deletions
|
@ -6826,6 +6826,19 @@ impl<'a> Parser<'a> {
|
|||
/// Parse a restricted `SELECT` statement (no CTEs / `UNION` / `ORDER BY`),
|
||||
/// assuming the initial `SELECT` was already consumed
|
||||
pub fn parse_select(&mut self) -> Result<Select, ParserError> {
|
||||
let value_table_mode =
|
||||
if dialect_of!(self is BigQueryDialect) && self.parse_keyword(Keyword::AS) {
|
||||
if self.parse_keyword(Keyword::VALUE) {
|
||||
Some(ValueTableMode::AsValue)
|
||||
} else if self.parse_keyword(Keyword::STRUCT) {
|
||||
Some(ValueTableMode::AsStruct)
|
||||
} else {
|
||||
self.expected("VALUE or STRUCT", self.peek_token())?
|
||||
}
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
||||
let distinct = self.parse_all_or_distinct()?;
|
||||
|
||||
let top = if self.parse_keyword(Keyword::TOP) {
|
||||
|
@ -6962,6 +6975,7 @@ impl<'a> Parser<'a> {
|
|||
having,
|
||||
named_window: named_windows,
|
||||
qualify,
|
||||
value_table_mode,
|
||||
})
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue