This is an automated email from the ASF dual-hosted git repository.
alamb pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/datafusion.git
The following commit(s) were added to refs/heads/main by this push:
new 47151fd2ac Minor: add err on `create` `temporary` table (#12439)
47151fd2ac is described below
commit 47151fd2acd66f08421469c596d60931b835ac56
Author: Haile <[email protected]>
AuthorDate: Thu Sep 12 17:17:18 2024 +0100
Minor: add err on `create` `temporary` table (#12439)
Signed-off-by: Haile Lagi <[email protected]>
---
datafusion/sql/src/parser.rs | 4 ++++
datafusion/sqllogictest/test_files/create_external_table.slt | 10 ++++++++++
2 files changed, 14 insertions(+)
diff --git a/datafusion/sql/src/parser.rs b/datafusion/sql/src/parser.rs
index 2df8d89c59..744b56d552 100644
--- a/datafusion/sql/src/parser.rs
+++ b/datafusion/sql/src/parser.rs
@@ -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()?)))
}
diff --git a/datafusion/sqllogictest/test_files/create_external_table.slt
b/datafusion/sqllogictest/test_files/create_external_table.slt
index e42d14e101..dcdb24c348 100644
--- a/datafusion/sqllogictest/test_files/create_external_table.slt
+++ b/datafusion/sqllogictest/test_files/create_external_table.slt
@@ -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)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]