Skip to content

Commit 37581a6

Browse files
committed
Fixing location for extrenal tables
1 parent 4beea9a commit 37581a6

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/ast/ddl.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2803,7 +2803,9 @@ impl fmt::Display for CreateTable {
28032803
if let Some(file_format) = self.file_format {
28042804
write!(f, " STORED AS {file_format}")?;
28052805
}
2806-
write!(f, " LOCATION '{}'", self.location.as_ref().unwrap())?;
2806+
if let Some(location) = &self.location {
2807+
write!(f, " LOCATION '{location}'")?;
2808+
}
28072809
}
28082810

28092811
match &self.table_options {

tests/sqlparser_hive.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -566,3 +566,8 @@ fn hive() -> TestedDialects {
566566
fn hive_and_generic() -> TestedDialects {
567567
TestedDialects::new(vec![Box::new(HiveDialect {}), Box::new(GenericDialect {})])
568568
}
569+
570+
#[test]
571+
fn parse_create_external_table_without_location() {
572+
hive().verified_stmt("CREATE EXTERNAL TABLE t (c INT)");
573+
}

0 commit comments

Comments
 (0)