@@ -695,10 +695,14 @@ impl<'a> DFParser<'a> {
695695
696696 /// Parse a SQL `CREATE` statement handling `CREATE EXTERNAL TABLE`
697697 pub fn parse_create ( & mut self ) -> Result < Statement , DataFusionError > {
698- if self . parser . parse_keyword ( Keyword :: EXTERNAL ) {
698+ if self
699+ . parser
700+ . parse_keywords ( & [ Keyword :: EXTERNAL , Keyword :: TABLE ] )
701+ {
699702 self . parse_create_external_table ( false )
700703 } else if self . parser . parse_keyword ( Keyword :: UNBOUNDED ) {
701- self . parser . expect_keyword ( Keyword :: EXTERNAL ) ?;
704+ self . parser
705+ . expect_keywords ( & [ Keyword :: EXTERNAL , Keyword :: TABLE ] ) ?;
702706 self . parse_create_external_table ( true )
703707 } else {
704708 // Push back CREATE
@@ -856,7 +860,6 @@ impl<'a> DFParser<'a> {
856860 . parser
857861 . parse_one_of_keywords ( & [ Keyword :: TEMP , Keyword :: TEMPORARY ] )
858862 . is_some ( ) ;
859- self . parser . expect_keyword ( Keyword :: TABLE ) ?;
860863 let if_not_exists =
861864 self . parser
862865 . parse_keywords ( & [ Keyword :: IF , Keyword :: NOT , Keyword :: EXISTS ] ) ;
@@ -1595,6 +1598,24 @@ mod tests {
15951598 Ok ( ( ) )
15961599 }
15971600
1601+ #[ test]
1602+ fn skip_external_volume ( ) -> Result < ( ) , DataFusionError > {
1603+ let sql = "CREATE OR REPLACE EXTERNAL VOLUME exvol STORAGE_LOCATIONS =
1604+ ((NAME = 's3' STORAGE_PROVIDER = 'S3' STORAGE_BASE_URL = 's3://my-example-bucket/' ))" ;
1605+ let dialect = Box :: new ( SnowflakeDialect ) ;
1606+ let statements = DFParser :: parse_sql_with_dialect ( sql, dialect. as_ref ( ) ) ?;
1607+
1608+ assert_eq ! (
1609+ statements. len( ) ,
1610+ 1 ,
1611+ "Expected to parse exactly one statement"
1612+ ) ;
1613+ if let Statement :: CreateExternalTable ( _) = & statements[ 0 ] {
1614+ panic ! ( "Expected non CREATE EXTERNAL TABLE statement, but was successful: {statements:?}" ) ;
1615+ }
1616+ Ok ( ( ) )
1617+ }
1618+
15981619 #[ test]
15991620 fn explain_copy_to_table_to_table ( ) -> Result < ( ) , DataFusionError > {
16001621 let cases = vec ! [
0 commit comments