alamb opened a new issue, #12607: URL: https://github.com/apache/datafusion/issues/12607
### Describe the bug DataFusion will create external tables with qualified names as though they were single names For example, this statement will create a table name `"staging.foo"` in the default schema, rather than a table named `foo` in the `staging` schema ```sql create external table staging.foo stored as csv location 'foo.csv'; ``` ### To Reproduce Create foo.csv: ```shell echo "x" > foo.csv echo "1" >> foo.csv ``` Run SQL: ```sql DataFusion CLI v42.0.0 > create schema staging; 0 row(s) fetched. Elapsed 0.001 seconds. > create external table staging.foo stored as csv location 'foo.csv'; 0 row(s) fetched. Elapsed 0.011 seconds. > select * from staging.foo; Error during planning: table 'datafusion.staging.foo' not found > select * from "staging.foo"; +---+ | x | +---+ | 1 | +---+ 1 row(s) fetched. Elapsed 0.005 seconds. ``` ### Expected behavior The external table should be named `foo` in the `staging` schema Note this works as expected for `CREATE TABLE` (just not `CREATE EXTERNAL TABLE`) ```sql > create table staging.bar as values (2); 0 row(s) fetched. Elapsed 0.006 seconds. > select * from staging.bar; +---------+ | column1 | +---------+ | 2 | +---------+ 1 row(s) fetched. Elapsed 0.001 seconds. > show tables; +---------------+--------------------+-------------+------------+ | table_catalog | table_schema | table_name | table_type | +---------------+--------------------+-------------+------------+ | datafusion | public | staging.foo | BASE TABLE | | datafusion | staging | bar | BASE TABLE | | datafusion | information_schema | tables | VIEW | | datafusion | information_schema | views | VIEW | | datafusion | information_schema | columns | VIEW | | datafusion | information_schema | df_settings | VIEW | | datafusion | information_schema | schemata | VIEW | +---------------+--------------------+-------------+------------+ 7 row(s) fetched. Elapsed 0.004 seconds. ``` ### Additional context Found by @matthewmturner in https://github.com/datafusion-contrib/datafusion-dft/issues/154#issuecomment-2371404530 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For additional commands, e-mail: github-h...@datafusion.apache.org