Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add TableProvider.statistics method #3986

Merged
merged 1 commit into from
Oct 28, 2022

Conversation

andygrove
Copy link
Member

Which issue does this PR close?

Closes #3983

Rationale for this change

I would like the ability for table providers to provide statistics that can be used in logical plan optimizations, such as join reordering.

What changes are included in this PR?

Add new TableProvider.statistics method

Are there any user-facing changes?

No. The method has a default implementation.

@andygrove
Copy link
Member Author

@isidentical @Dandandan @alamb PTAL when you can

@github-actions github-actions bot added the core Core DataFusion crate label Oct 27, 2022
Copy link
Contributor

@Dandandan Dandandan left a comment

Choose a reason for hiding this comment

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

LGTM

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.

@@ -77,6 +78,11 @@ pub trait TableProvider: Sync + Send {
) -> Result<TableProviderFilterPushDown> {
Ok(TableProviderFilterPushDown::Unsupported)
}

/// Get statistics for this table, if available
fn statistics(&self) -> Option<Statistics> {
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if any of the built in providers can give statistic (I am thinking Parquet) 🤔

Definitely something for a follow on PR

Copy link
Member Author

Choose a reason for hiding this comment

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

👍 Filed as #3988

Copy link
Contributor

@isidentical isidentical left a comment

Choose a reason for hiding this comment

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

Looks great as well.

@mingmwang
Copy link
Contributor

Does it mean that we already decide to move the stats back to the LogicalPlan ?

@Dandandan
Copy link
Contributor

Does it mean that we already decide to move the stats back to the LogicalPlan ?

It seems this change would make it more hybrid. I would like to continue discussing in the Google doc what is the best way forward.

@andygrove
Copy link
Member Author

Does it mean that we already decide to move the stats back to the LogicalPlan ?

No. This change is independent of any existing cost based optimizations.

@andygrove andygrove merged commit 4ea970d into apache:master Oct 28, 2022
@andygrove andygrove deleted the table-provider-stats branch October 28, 2022 09:49
@ursabot
Copy link

ursabot commented Oct 28, 2022

Benchmark runs are scheduled for baseline = 0678093 and contender = 4ea970d. 4ea970d 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

jimexist pushed a commit to jimexist/arrow-datafusion that referenced this pull request Oct 31, 2022
Dandandan pushed a commit to yuuch/arrow-datafusion that referenced this pull request Nov 5, 2022
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.

Add statistics methods to TableProvider trait for use in cost-based optimizations in the logical plan
6 participants