Skip to content

Cache collected file statistics - #3649

Merged
alamb merged 2 commits into
apache:masterfrom
mateuszkj:cache_stats
Oct 3, 2022
Merged

Cache collected file statistics#3649
alamb merged 2 commits into
apache:masterfrom
mateuszkj:cache_stats

Conversation

@mateuszkj

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

Closes#871 (but I'm not sure about that).

Rationale for this change

Reduce I/O by collecting statistics for files (parquet) only once in ListingTable.

What changes are included in this PR?

Store collected statistics in cache per file location.

Cache is invalided when:

  • File size has changed
  • File last modification has changed

Are there any user-facing changes?

No.

Or maybe mention that sometimes when collect_stats is enabled first query can be much slower due to increased I/O while collecting statistics. Cached statistics are invalidated in next query when table file has changed.

@github-actionsgithub-actionsBot added the core Core DataFusion crate label Sep 28, 2022
@mateuszkj

Copy link
Copy Markdown
ContributorAuthor

JYI, collecting statistics is disabled when creating table from SQL (CREATE EXTERNAL TABLE ..), it's different behavior when using function SessionContext.register_parquet(..) where collecting statistics is enabled.

https://github.com/apache/arrow-datafusion/blob/master/datafusion/core/src/execution/context.rs#L507 -> collect_stat: false

https://github.com/apache/arrow-datafusion/blob/master/datafusion/core/src/execution/options.rs#L195 -> collect_stat: true

I'm not sure if it's intended.

@codecov-commenter

codecov-commenter commented Sep 29, 2022

Copy link
Copy Markdown

Codecov Report

Merging #3649 (b6c7608) into master (b4c0601) will increase coverage by 0.00%.
The diff coverage is 87.50%.

@@ Coverage Diff @@## master #3649 +/- ##
=======================================
Coverage 86.01% 86.01% =======================================
Files 300 300 Lines 56543 56595 +52 =======================================
+ Hits 48633 48682 +49 - Misses 7910 7913 +3 
Impacted FilesCoverage Δ
datafusion/core/src/datasource/listing/table.rs90.40% <87.50%> (+0.19%)⬆️
datafusion/expr/src/window_frame.rs92.43% <0.00%> (-0.85%)⬇️
datafusion/expr/src/logical_plan/plan.rs77.26% <0.00%> (ø)
datafusion/optimizer/src/reduce_outer_join.rs98.35% <0.00%> (+0.15%)⬆️
datafusion/core/src/physical_plan/metrics/value.rs87.56% <0.00%> (+0.49%)⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@alambalamb left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good to me -- thank you @mateuszkj

@alamb
alamb merged commit 85c11c1 into apache:masterOct 3, 2022
@ursabot

Copy link
Copy Markdown

Benchmark runs are scheduled for baseline = f706902 and contender = 85c11c1. 85c11c1 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

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

coreCore DataFusion crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DataFusion should scan Parquet statistics once per query

4 participants

@mateuszkj@codecov-commenter@ursabot@alamb