Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 22 additions & 16 deletions datafusion-cli/src/exec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -421,14 +421,18 @@ async fn create_plan(
if let LogicalPlan::Ddl(DdlStatement::CreateExternalTable(cmd)) = &plan {
// To support custom formats, treat error as None
let format = config_file_type_from_str(&cmd.file_type);
register_object_store_and_config_extensions(
ctx,
&cmd.location,
&cmd.options,
format,
resolve_region,
)
.await?;
// A table may reference more than one location; register the object
// store for each of them.
for location in &cmd.locations {
register_object_store_and_config_extensions(
ctx,
location,
&cmd.options,
format.clone(),
resolve_region,
)
.await?;
}
}

if let LogicalPlan::Copy(copy_to) = &mut plan {
Expand Down Expand Up @@ -531,14 +535,16 @@ mod tests {

if let LogicalPlan::Ddl(DdlStatement::CreateExternalTable(cmd)) = &plan {
let format = config_file_type_from_str(&cmd.file_type);
register_object_store_and_config_extensions(
&ctx,
&cmd.location,
&cmd.options,
format,
false,
)
.await?;
for location in &cmd.locations {
register_object_store_and_config_extensions(
&ctx,
location,
&cmd.options,
format.clone(),
false,
)
.await?;
}
} else {
return plan_err!("LogicalPlan is not a CreateExternalTable");
}
Expand Down
10 changes: 9 additions & 1 deletion datafusion/catalog/src/stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,15 @@ impl TableProviderFactory for StreamTableFactory {
cmd: &CreateExternalTable,
) -> Result<Arc<dyn TableProvider>> {
let schema: SchemaRef = Arc::clone(cmd.schema.inner());
let location = cmd.location.clone();
let location = match cmd.locations.as_slice() {
[single] => single.clone(),
_ => {
return config_err!(
"Stream tables support exactly one location; \
use a listing table to read multiple files"
);
}
};
let encoding = cmd.file_type.parse()?;
let header = if let Ok(opt) = cmd
.options
Expand Down
Loading
Loading