alamb commented on code in PR #3279:
URL: https://github.com/apache/arrow-datafusion/pull/3279#discussion_r962135903
##########
datafusion/core/tests/sql/information_schema.rs:
##########
@@ -605,6 +605,29 @@ async fn show_create_table() {
assert_batches_eq!(expected, &results);
}
+#[tokio::test]
+async fn show_external_create_table() {
+ let ctx =
+
SessionContext::with_config(SessionConfig::new().with_information_schema(true));
+
+ let table_sql =
+ "CREATE EXTERNAL TABLE abc STORED AS CSV WITH HEADER ROW LOCATION
'../../testing/data/csv/aggregate_test_100.csv'";
+ plan_and_collect(&ctx, table_sql).await.unwrap();
+
+ let result_sql = "SHOW CREATE TABLE abc";
+ let results = plan_and_collect(&ctx, result_sql).await.unwrap();
+
+ let expected = vec![
+
"+---------------+--------------+------------+-------------------------------------------------------------------------------------------------+",
+ "| table_catalog | table_schema | table_name | definition
|",
+
"+---------------+--------------+------------+-------------------------------------------------------------------------------------------------+",
+ "| datafusion | public | abc | CREATE EXTERNAL TABLE
abc STORED AS CSV LOCATION ../../testing/data/csv/aggregate_test_100.csv |",
Review Comment:
❤️ this is great
##########
datafusion/core/src/datasource/listing/table.rs:
##########
@@ -256,7 +257,10 @@ impl ListingTable {
/// If the schema is provided then it must be resolved before creating the
table
/// and should contain the fields of the file without the table
/// partitioning columns.
- pub fn try_new(config: ListingTableConfig) -> Result<Self> {
+ pub fn try_new(
+ config: ListingTableConfig,
+ definition: Option<String>,
Review Comment:
This is the only thing I would prefer to change in this PR. Specifically,
rather than change the API of `try_new` I think we could add a function like
```rust
pub fn with_definition(mut self, defintion: Option<String>) -> Self {
...
}
```
This change I think would reduce the size of this PR significantly
Since I realize this PR has been waiting for a week for feedback I will
propose this change via PR
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]