Skip to content

Consolidate ParquetExec tests in parquet_exec integration test #4130

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

Merged
merged 3 commits into from
Nov 8, 2022
Merged
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
2 changes: 2 additions & 0 deletions datafusion/core/src/physical_plan/file_format/parquet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -900,6 +900,8 @@ pub async fn plan_to_parquet(

#[cfg(test)]
mod tests {
// See also `parquet_exec` integration test

use super::*;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Ted-Jiang / @tustvold / @thinkharderdev what do you think about moving the remaining tests in this module into the integration test?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think some of them may make use of crate private functions, otherwise I have no strong feeling either way

Copy link
Contributor Author

@alamb alamb Nov 7, 2022

Choose a reason for hiding this comment

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

👍 yes I think the pruning ones in particular do so -- I would likely need to refactor somehow

Copy link
Contributor

Choose a reason for hiding this comment

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

No objection from me. I think we can probably leave the pruning tests as unit tests here and just move the more "integration-y" tests?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah the only real reason to consolidate them is that my sense of order is somewhat violated that the three kinds of parquet predicate pushdown are not in the same pattern

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe I will pursue the idea as a small follow on refactor

use crate::config::ConfigOptions;
use crate::datasource::file_format::parquet::test_util::store_parquet;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ async fn single_file_small_data_pages() {

// TestCase::new(&test_parquet_file)
// .with_name("selective")
// // predicagte is chosen carefully to prune pages 0, 1, 2, 3, 4
// // predicate is chosen carefully to prune pages 0, 1, 2, 3, 4
// // pod = 'iadnalqpdzthpifrvewossmpqibgtsuin'
// .with_filter(col("pod").eq(lit("iadnalqpdzthpifrvewossmpqibgtsuin")))
// .with_pushdown_expected(PushdownExpected::Some)
Expand All @@ -291,7 +291,7 @@ async fn single_file_small_data_pages() {
// page 5: DLE:RLE RLE:RLE VLE:RLE_DICTIONARY ST:[min: 1970-01-01T00:00:00.000000000, max: 1970-01-01T00:00:00.005330944, num_nulls not defined] CRC:[none] SZ:12601 VC:7739
TestCase::new(&test_parquet_file)
.with_name("selective")
// predicagte is chosen carefully to prune pages
// predicate is chosen carefully to prune pages 1, 2, 4, and 5
// time > 1970-01-01T00:00:00.004300000
.with_filter(col("time").gt(lit_timestamp_nano(4300000)))
.with_pushdown_expected(PushdownExpected::Some)
Expand Down
21 changes: 21 additions & 0 deletions datafusion/core/tests/parquet/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.

//! Parquet integration tests
mod filter_pushdown;
mod page_pruning;
mod row_group_pruning;
19 changes: 19 additions & 0 deletions datafusion/core/tests/parquet_exec.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.

/// Run all tests that are found in the `parquet` directory
mod parquet;
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 idea is that this has become a single integration test that runs rather than three independent ones (that each need to be compiled / linked / run serially)

Copy link
Member

Choose a reason for hiding this comment

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

Sounds reasonable ! 👍

2 changes: 1 addition & 1 deletion datafusion/core/tests/sql/order.rs
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ async fn sort_empty() -> Result<()> {
#[tokio::test]
async fn sort_with_lots_of_repetition_values() -> Result<()> {
let ctx = SessionContext::new();
let filename = "tests/parquet/repeat_much.snappy.parquet";
let filename = "tests/parquet/data/repeat_much.snappy.parquet";

ctx.register_parquet("rep", filename, ParquetReadOptions::default())
.await?;
Expand Down
2 changes: 1 addition & 1 deletion datafusion/core/tests/sql/parquet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ async fn fixed_size_binary_columns() {
let ctx = SessionContext::new();
ctx.register_parquet(
"t0",
"tests/parquet/test_binary.parquet",
"tests/parquet/data/test_binary.parquet",
ParquetReadOptions::default(),
)
.await
Expand Down