You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "alamb (via GitHub)" <gi...@apache.org> on 2023/12/06 11:41:06 UTC
[PR] Alamb/less test copy pasta2 [arrow-datafusion]
alamb opened a new pull request, #8435:
URL: https://github.com/apache/arrow-datafusion/pull/8435
Draft as it builds on https://github.com/apache/arrow-datafusion/pull/8433
## Which issue does this PR close?
Follow on to https://github.com/apache/arrow-datafusion/pull/8433
## Rationale for this change
The bloom filter tests have substantial duplication. This PR refactors out the common patterns.
## What changes are included in this PR?
Refactor BoomFilter tests
## Are these changes tested?
All tests
<!--
We typically require tests for all PRs in order to:
1. Prevent the code from being accidentally broken by subsequent changes
2. Serve as another way to document the expected behavior of the code
If tests are not included in your PR, please explain why (for example, are they covered by existing tests)?
-->
## Are there any user-facing changes?
<!--
If there are user-facing changes then we may require documentation to be updated before approving the PR.
-->
<!--
If there are any breaking changes to public APIs, please add the `api change` label.
-->
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Minor: refactor bloom filter tests to reduce duplication [arrow-datafusion]
Posted by "korowa (via GitHub)" <gi...@apache.org>.
korowa commented on code in PR #8435:
URL: https://github.com/apache/arrow-datafusion/pull/8435#discussion_r1436901619
##########
datafusion/core/src/datasource/physical_plan/parquet/row_groups.rs:
##########
@@ -1075,82 +1075,28 @@ mod tests {
create_physical_expr(expr, &df_schema, schema, &execution_props).unwrap()
}
- // Note the values in the `String` column are:
- // ❯ select * from './parquet-testing/data/data_index_bloom_encoding_stats.parquet';
- // +-----------+
- // | String |
- // +-----------+
- // | Hello |
- // | This is |
- // | a |
- // | test |
- // | How |
- // | are you |
- // | doing |
- // | today |
- // | the quick |
- // | brown fox |
- // | jumps |
- // | over |
- // | the lazy |
- // | dog |
- // +-----------+
#[tokio::test]
async fn test_row_group_bloom_filter_pruning_predicate_simple_expr() {
- // load parquet file
- let testdata = datafusion_common::test_util::parquet_test_data();
- let file_name = "data_index_bloom_encoding_stats.parquet";
- let path = format!("{testdata}/{file_name}");
- let data = bytes::Bytes::from(std::fs::read(path).unwrap());
-
- // generate pruning predicate `(String = "Hello_Not_exists")`
- let schema = Schema::new(vec![Field::new("String", DataType::Utf8, false)]);
- let expr = col(r#""String""#).eq(lit("Hello_Not_Exists"));
- let expr = logical2physical(&expr, &schema);
- let pruning_predicate =
- PruningPredicate::try_new(expr, Arc::new(schema)).unwrap();
-
- let row_groups = vec![0];
- let pruned_row_groups = test_row_group_bloom_filter_pruning_predicate(
- file_name,
- data,
- &pruning_predicate,
- &row_groups,
- )
- .await
- .unwrap();
- assert!(pruned_row_groups.is_empty());
+ BloomFilterTest::new_data_index_bloom_encoding_stats()
+ .with_expect_all_pruned()
+ // generate pruning predicate `(String = "Hello_Not_exists")`
+ .run(col(r#""String""#).eq(lit("Hello_Not_Exists")))
+ .await
}
#[tokio::test]
async fn test_row_group_bloom_filter_pruning_predicate_mutiple_expr() {
- // load parquet file
- let testdata = datafusion_common::test_util::parquet_test_data();
- let file_name = "data_index_bloom_encoding_stats.parquet";
- let path = format!("{testdata}/{file_name}");
- let data = bytes::Bytes::from(std::fs::read(path).unwrap());
-
- // generate pruning predicate `(String = "Hello_Not_exists" OR String = "Hello_Not_exists2")`
- let schema = Schema::new(vec![Field::new("String", DataType::Utf8, false)]);
- let expr = lit("1").eq(lit("1")).and(
- col(r#""String""#)
- .eq(lit("Hello_Not_Exists"))
- .or(col(r#""String""#).eq(lit("Hello_Not_Exists2"))),
- );
- let expr = logical2physical(&expr, &schema);
- let pruning_predicate =
- PruningPredicate::try_new(expr, Arc::new(schema)).unwrap();
-
- let row_groups = vec![0];
- let pruned_row_groups = test_row_group_bloom_filter_pruning_predicate(
- file_name,
- data,
- &pruning_predicate,
- &row_groups,
- )
- .await
- .unwrap();
- assert!(pruned_row_groups.is_empty());
+ BloomFilterTest::new_data_index_bloom_encoding_stats()
+ .with_expect_all_pruned()
+ // generate pruning predicate `(String = "Hello_Not_exists" OR String = "Hello_Not_exists2")`
Review Comment:
A bit controversial due to `"1" = "1"` part in actual test case expression.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Minor: refactor bloom filter tests to reduce duplication [arrow-datafusion]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on PR #8435:
URL: https://github.com/apache/arrow-datafusion/pull/8435#issuecomment-1873329273
@waynexia or @yahoNanJing could I perhaps request your review of this PR? I can not merge it without another committer's review:

--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Minor: refactor bloom filter tests to reduce duplication [arrow-datafusion]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on code in PR #8435:
URL: https://github.com/apache/arrow-datafusion/pull/8435#discussion_r1437021752
##########
datafusion/core/src/datasource/physical_plan/parquet/row_groups.rs:
##########
@@ -1075,82 +1075,28 @@ mod tests {
create_physical_expr(expr, &df_schema, schema, &execution_props).unwrap()
}
- // Note the values in the `String` column are:
- // ❯ select * from './parquet-testing/data/data_index_bloom_encoding_stats.parquet';
- // +-----------+
- // | String |
- // +-----------+
- // | Hello |
- // | This is |
- // | a |
- // | test |
- // | How |
- // | are you |
- // | doing |
- // | today |
- // | the quick |
- // | brown fox |
- // | jumps |
- // | over |
- // | the lazy |
- // | dog |
- // +-----------+
#[tokio::test]
async fn test_row_group_bloom_filter_pruning_predicate_simple_expr() {
- // load parquet file
- let testdata = datafusion_common::test_util::parquet_test_data();
- let file_name = "data_index_bloom_encoding_stats.parquet";
- let path = format!("{testdata}/{file_name}");
- let data = bytes::Bytes::from(std::fs::read(path).unwrap());
-
- // generate pruning predicate `(String = "Hello_Not_exists")`
- let schema = Schema::new(vec![Field::new("String", DataType::Utf8, false)]);
- let expr = col(r#""String""#).eq(lit("Hello_Not_Exists"));
- let expr = logical2physical(&expr, &schema);
- let pruning_predicate =
- PruningPredicate::try_new(expr, Arc::new(schema)).unwrap();
-
- let row_groups = vec![0];
- let pruned_row_groups = test_row_group_bloom_filter_pruning_predicate(
- file_name,
- data,
- &pruning_predicate,
- &row_groups,
- )
- .await
- .unwrap();
- assert!(pruned_row_groups.is_empty());
+ BloomFilterTest::new_data_index_bloom_encoding_stats()
+ .with_expect_all_pruned()
+ // generate pruning predicate `(String = "Hello_Not_exists")`
+ .run(col(r#""String""#).eq(lit("Hello_Not_Exists")))
+ .await
}
#[tokio::test]
async fn test_row_group_bloom_filter_pruning_predicate_mutiple_expr() {
- // load parquet file
- let testdata = datafusion_common::test_util::parquet_test_data();
- let file_name = "data_index_bloom_encoding_stats.parquet";
- let path = format!("{testdata}/{file_name}");
- let data = bytes::Bytes::from(std::fs::read(path).unwrap());
-
- // generate pruning predicate `(String = "Hello_Not_exists" OR String = "Hello_Not_exists2")`
- let schema = Schema::new(vec![Field::new("String", DataType::Utf8, false)]);
- let expr = lit("1").eq(lit("1")).and(
- col(r#""String""#)
- .eq(lit("Hello_Not_Exists"))
- .or(col(r#""String""#).eq(lit("Hello_Not_Exists2"))),
- );
- let expr = logical2physical(&expr, &schema);
- let pruning_predicate =
- PruningPredicate::try_new(expr, Arc::new(schema)).unwrap();
-
- let row_groups = vec![0];
- let pruned_row_groups = test_row_group_bloom_filter_pruning_predicate(
- file_name,
- data,
- &pruning_predicate,
- &row_groups,
- )
- .await
- .unwrap();
- assert!(pruned_row_groups.is_empty());
+ BloomFilterTest::new_data_index_bloom_encoding_stats()
+ .with_expect_all_pruned()
+ // generate pruning predicate `(String = "Hello_Not_exists" OR String = "Hello_Not_exists2")`
Review Comment:
I agree -- I am not sure what the `"1" = "1"` is all about. @haohuaijin or @waynexia do you remember?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Minor: refactor bloom filter tests to reduce duplication [arrow-datafusion]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb merged PR #8435:
URL: https://github.com/apache/arrow-datafusion/pull/8435
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Minor: refactor bloom filter tests to reduce duplication [arrow-datafusion]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on PR #8435:
URL: https://github.com/apache/arrow-datafusion/pull/8435#issuecomment-1874183431
Thank you @Ted-Jiang 🙏
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org