Skip to content
Merged
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
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ recursive = "0.1.1"
regex = "1.8"
rstest = "0.24.0"
serde_json = "1"
sqlparser = { git = "https://github.com/Embucket/datafusion-sqlparser-rs.git", rev = "12655c2be19d4796236154f8826e23f84d2978b0", features = [
sqlparser = { git = "https://github.com/Embucket/datafusion-sqlparser-rs.git", rev = "4a91f2fd6af1b6d413621949e724c55c34f8a29b", features = [
"visitor",
] }
tempfile = "3"
Expand Down
24 changes: 24 additions & 0 deletions datafusion/sql/src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,12 @@ impl<'a> DFParser<'a> {
Token::Word(w) => {
match w.keyword {
Keyword::CREATE => {
if let Token::Word(w) = self.parser.peek_nth_token(2).token {
// use native parser for CREATE EXTERNAL VOLUME
if w.keyword == Keyword::VOLUME {
return self.parse_and_handle_statement();
}
}
self.parser.next_token(); // CREATE
self.parse_create()
}
Expand Down Expand Up @@ -1595,6 +1601,24 @@ mod tests {
Ok(())
}

#[test]
fn skip_external_volume() -> Result<(), DataFusionError> {
let sql = "CREATE OR REPLACE EXTERNAL VOLUME exvol STORAGE_LOCATIONS =
((NAME = 's3' STORAGE_PROVIDER = 'S3' STORAGE_BASE_URL = 's3://my-example-bucket/' ))";
let dialect = Box::new(SnowflakeDialect);
let statements = DFParser::parse_sql_with_dialect(sql, dialect.as_ref())?;

assert_eq!(
statements.len(),
1,
"Expected to parse exactly one statement"
);
if let Statement::CreateExternalTable(_) = &statements[0] {
panic!("Expected non CREATE EXTERNAL TABLE statement, but was successful: {statements:?}");
}
Ok(())
}

#[test]
fn explain_copy_to_table_to_table() -> Result<(), DataFusionError> {
let cases = vec![
Expand Down