Skip to content

Conversation

@milenkovicm
Copy link
Contributor

Which issue does this PR close?

Closes #4142.

Rationale for this change

What changes are included in this PR?

Are these changes tested?

Are there any user-facing changes?

TableProviderFactory::create is a public interface and change will be backward incompatible, but as this interface is in state of flux recently it would make sense to break it now

@github-actions github-actions bot added the core Core DataFusion crate label Nov 8, 2022
@milenkovicm milenkovicm changed the title update table provider factory to schema parameter add schema parameter to table provider factory create method Nov 8, 2022
@andygrove
Copy link
Member

Thanks @milenkovicm. The changes seem reasonable, but could you add some tests?

@milenkovicm
Copy link
Contributor Author

thanks @andygrove,
I've added test which should check if table schema is according to ddl provided in the crate statement. Let me know if you have some other cases to test.

@andygrove
Copy link
Member

@avantgardnerio may be interested in reviewing this as well

Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks -- looks great to me @milenkovicm

Looks like there are now some conflicts but otherwise this PR is ready to go


assert_eq!(3, table_schema.fields().len());

assert_eq!(&DataType::Int32, table_schema.field(0).data_type());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@milenkovicm
Copy link
Contributor Author

thanks @alamb, looks like #4126 did most of the job I was intending with this pr, schema can be extracted from cmd directly. so this pr at the end contributes test for part of #4126

Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @milenkovicm

async fn create_external_table_with_ddl() -> Result<()> {
let mut table_factories: HashMap<String, Arc<dyn TableProviderFactory>> =
HashMap::new();
table_factories.insert("mocktable".to_string(), Arc::new(TestTableFactory {}));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is so cool

@alamb alamb merged commit 9692fb0 into apache:master Nov 9, 2022
@ursabot
Copy link

ursabot commented Nov 9, 2022

Benchmark runs are scheduled for baseline = 1303543 and contender = 9692fb0. 9692fb0 is a master commit associated with this PR. Results will be available as each benchmark for each run completes.
Conbench compare runs links:
[Skipped ⚠️ Benchmarking of arrow-datafusion-commits is not supported on ec2-t3-xlarge-us-east-2] ec2-t3-xlarge-us-east-2
[Skipped ⚠️ Benchmarking of arrow-datafusion-commits is not supported on test-mac-arm] test-mac-arm
[Skipped ⚠️ Benchmarking of arrow-datafusion-commits is not supported on ursa-i9-9960x] ursa-i9-9960x
[Skipped ⚠️ Benchmarking of arrow-datafusion-commits is not supported on ursa-thinkcentre-m75q] ursa-thinkcentre-m75q
Buildkite builds:
Supported benchmarks:
ec2-t3-xlarge-us-east-2: Supported benchmark langs: Python, R. Runs only benchmarks with cloud = True
test-mac-arm: Supported benchmark langs: C++, Python, R
ursa-i9-9960x: Supported benchmark langs: Python, R, JavaScript
ursa-thinkcentre-m75q: Supported benchmark langs: C++, Java

@milenkovicm milenkovicm deleted the table_provider_factory_schema branch November 16, 2022 11:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core Core DataFusion crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TableProviderFactory::create should have Optional<DFSchemaRef> parameter

5 participants