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

Extract common parquet testing code to parquet-test-util crate #4042

Merged
merged 2 commits into from
Nov 1, 2022

Conversation

alamb
Copy link
Contributor

@alamb alamb commented Oct 31, 2022

Which issue does this PR close?

Part of #3463

Rationale for this change

To create parquet integration testing (#3976) , I want to reuse code from a pre-existing benchmark

What changes are included in this PR?

  1. Create parquet-testing-utils crate
  2. Move the code to create temporary testing parquet files to that new crate

Are there any user-facing changes?

No, this is just moving code around

@alamb alamb marked this pull request as draft October 31, 2022 13:15
@alamb alamb force-pushed the alamb/parquet_predicate_refactor branch from ce9d131 to b159106 Compare October 31, 2022 13:34
filter: Expr,
scan_options: ParquetScanOptions,
debug: bool,
) -> Result<usize> {
let ParquetScanOptions {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

All this code is simply moved into parquet-test-utils and the TestParquetFile struct

use parquet::file::properties::WriterProperties;

/// a ParquetFile that has been created for testing.
pub struct TestParquetFile {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The point of this PR is to refactor common code from the benchmark into TestParquetFile for use in testing

@@ -190,6 +190,11 @@ pub struct AccessLogGenerator {
schema: SchemaRef,
rng: StdRng,
host_idx: usize,

/// optional number of rows produced
row_limit: Option<usize>,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Limits to control the maximum parquet size

@alamb alamb marked this pull request as ready for review October 31, 2022 13:46
Copy link
Member

@xudong963 xudong963 left a comment

Choose a reason for hiding this comment

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

Good refactor!

@@ -17,7 +17,20 @@

[workspace]
exclude = ["datafusion-cli"]
members = ["datafusion/common", "datafusion/core", "datafusion/expr", "datafusion/jit", "datafusion/optimizer", "datafusion/physical-expr", "datafusion/proto", "datafusion/row", "datafusion/sql", "datafusion-examples", "benchmarks",
members = [
Copy link
Member

Choose a reason for hiding this comment

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

Clearly

@alamb
Copy link
Contributor Author

alamb commented Oct 31, 2022

Thanks for the review @xudong963

Copy link
Contributor

@tustvold tustvold left a comment

Choose a reason for hiding this comment

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

Mainly just some minor nits. Good to see extra mileage from this generator 👍

///
/// Recursively searches for ParquetExec and returns the metrics
/// on the first one it finds
pub fn parquet_metrics(&self, plan: Arc<dyn ExecutionPlan>) -> Option<MetricsSet> {
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this need to take &self?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No -- I am still in the object oriented frame of mind -- will remove

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done in #3976

impl TestParquetFile {
/// Creates a new parquet file at the specified location
pub fn try_new(
path: PathBuf,
Copy link
Contributor

Choose a reason for hiding this comment

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

Taking a File instead of a Path would allow passing in a file generated by tempfile::tempfile. Mainly just thinking that these are potentially fairly substantial files which we therefore should be careful to cleanup automatically

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is a good idea - thank you for the suggestion -- I tried to do this, but it seems as if the object store interface requires the length and canonical path which are currently computed from the path


        let size = std::fs::metadata(&path)?.len() as usize;

        let canonical_path = path.canonicalize()?;

Given this code is no worse than today I would like to leave it in this PR -- it does in fact leave large files around which I will attempt to clean up in #3976

@alamb
Copy link
Contributor Author

alamb commented Nov 1, 2022

Merging this PR in as I have another that is built on it and will address comments in follow on PRs

@alamb alamb merged commit 41467ab into apache:master Nov 1, 2022
@alamb alamb deleted the alamb/parquet_predicate_refactor branch November 1, 2022 13:07
@ursabot
Copy link

ursabot commented Nov 1, 2022

Benchmark runs are scheduled for baseline = ea31da9 and contender = 41467ab. 41467ab 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

Dandandan pushed a commit to yuuch/arrow-datafusion that referenced this pull request Nov 5, 2022
…che#4042)

* Extract common parquet testing code to `parquet-test-util` crate

* fix doc tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants