Skip to content

Commit

Permalink
Minor: add err on create temporary table (#12439)
Browse files Browse the repository at this point in the history
Signed-off-by: Haile Lagi <[email protected]>
  • Loading branch information
hailelagi committed Sep 12, 2024
1 parent e41ffec commit 47151fd
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
4 changes: 4 additions & 0 deletions datafusion/sql/src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,10 @@ impl<'a> DFParser<'a> {
} else if self.parser.parse_keyword(Keyword::UNBOUNDED) {
self.parser.expect_keyword(Keyword::EXTERNAL)?;
self.parse_create_external_table(true)
} else if self.parser.parse_keyword(Keyword::TEMPORARY) {
Err(ParserError::ParserError(
"Creating temporary tables is Unsupported".to_owned(),
))
} else {
Ok(Statement::Statement(Box::from(self.parser.parse_create()?)))
}
Expand Down
10 changes: 10 additions & 0 deletions datafusion/sqllogictest/test_files/create_external_table.slt
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,16 @@ STORED AS CSV
LOCATION 'foo.csv'
OPTIONS ('format.delimiter' ';', 'format.column_index_truncate_length' '123')

# Creating Temporary tables
statement error DataFusion error: SQL error: ParserError\("Creating temporary tables is Unsupported"\)
CREATE TEMPORARY TABLE my_temp_table (
id INTEGER PRIMARY KEY,
name TEXT NOT NULL
);

statement error DataFusion error: SQL error: ParserError\("Creating temporary tables is Unsupported"\)
CREATE TEMPORARY VIEW my_temp_view AS SELECT id, name FROM my_table;

# Partitioned table on a single file
query error DataFusion error: Error during planning: Can't create a partitioned table backed by a single file, perhaps the URL is missing a trailing slash\?
CREATE EXTERNAL TABLE single_file_partition(c1 int)
Expand Down

0 comments on commit 47151fd

Please sign in to comment.