Skip to content

Commit

Permalink
improve error message for invalid create table statement (#1294)
Browse files Browse the repository at this point in the history
* improve error message for invalid create table statement

* handle different create table cases using match
  • Loading branch information
QP Hou authored Nov 15, 2021
1 parent 05fdb7a commit ab72703
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions datafusion/src/sql/planner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,10 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {
input: Arc::new(plan),
})
}
Statement::CreateTable { .. } => Err(DataFusionError::NotImplemented(
"Only `CREATE TABLE table_name AS SELECT ...` statement is supported"
.to_string(),
)),

Statement::Drop {
object_type: ObjectType::Table,
Expand All @@ -185,9 +189,10 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {
table_name,
filter,
} => self.show_columns_to_plan(*extended, *full, table_name, filter.as_ref()),
_ => Err(DataFusionError::NotImplemented(
"Only SELECT statements are implemented".to_string(),
)),
_ => Err(DataFusionError::NotImplemented(format!(
"Unsupported SQL statement: {:?}",
sql
))),
}
}

Expand Down

0 comments on commit ab72703

Please sign in to comment.