File tree Expand file tree Collapse file tree 2 files changed +24
-1
lines changed Expand file tree Collapse file tree 2 files changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -914,7 +914,7 @@ impl SessionContext {
914914 ..
915915 } = cmd;
916916
917- // sqlparser doesnt accept database / catalog as parameter to CREATE SCHEMA
917+ // sqlparser doesn't accept database / catalog as parameter to CREATE SCHEMA
918918 // so for now, we default to default catalog
919919 let tokens: Vec < & str > = schema_name. split ( '.' ) . collect ( ) ;
920920 let ( catalog, schema_name) = match tokens. len ( ) {
Original file line number Diff line number Diff line change @@ -66,3 +66,26 @@ async fn create_external_table_with_ddl() -> Result<()> {
6666
6767 Ok ( ( ) )
6868}
69+
70+ #[ tokio:: test]
71+ async fn create_drop_table ( ) -> Result < ( ) > {
72+ let ctx = SessionContext :: new ( ) ;
73+
74+ let sql = "CREATE TABLE dt (a_id integer, a_str string, a_bool boolean);" ;
75+ ctx. sql ( sql) . await . unwrap ( ) ;
76+
77+ let cat = ctx. catalog ( "datafusion" ) . unwrap ( ) ;
78+ let schema = cat. schema ( "public" ) . unwrap ( ) ;
79+
80+ let exists = schema. table_exist ( "dt" ) ;
81+ assert ! ( exists, "Table should have been created!" ) ;
82+
83+ // Drop the table
84+ let sql = "DROP TABLE dt;" ;
85+ ctx. sql ( sql) . await . unwrap ( ) ;
86+
87+ let exists = schema. table_exist ( "dt" ) ;
88+ assert ! ( !exists, "Table should have been dropped!" ) ;
89+
90+ Ok ( ( ) )
91+ }
You can’t perform that action at this time.
0 commit comments