alamb commented on code in PR #24074:
URL: https://github.com/apache/datafusion/pull/24074#discussion_r3723640735
##########
datafusion/pruning/src/pruning_predicate.rs:
##########
@@ -388,18 +390,107 @@ pub fn build_pruning_predicate(
file_schema: &SchemaRef,
predicate_creation_errors: &Count,
) -> Option<Arc<PruningPredicate>> {
- match PruningPredicate::try_new(predicate, Arc::clone(file_schema)) {
- Ok(pruning_predicate) => {
- if !pruning_predicate.always_true() {
- return Some(Arc::new(pruning_predicate));
- }
+ PruningPredicateBuilder::new()
+ .with_file_schema(Arc::clone(file_schema))
+ .with_error_counter(predicate_creation_errors)
+ .build(predicate)
+}
+
+/// Builder for a [`PruningPredicate`]. Groups optional configuration —
Review Comment:
🎉 -- thank you 🙏
##########
datafusion/datasource-parquet/src/opener/mod.rs:
##########
@@ -1632,13 +1641,14 @@ pub(crate) fn build_pruning_predicates(
predicate: Option<&Arc<dyn PhysicalExpr>>,
file_schema: &SchemaRef,
predicate_creation_errors: &Count,
+ max_in_list_size: usize,
) -> Option<Arc<PruningPredicate>> {
let predicate = predicate.as_ref()?;
- build_pruning_predicate(
- Arc::clone(predicate),
- file_schema,
- predicate_creation_errors,
- )
+ PruningPredicateBuilder::new()
Review Comment:
👌
##########
datafusion/pruning/src/pruning_predicate.rs:
##########
@@ -461,7 +552,19 @@ impl PruningPredicate {
/// returns a new expression.
/// It is recommended that you pass the expressions through
[`PhysicalExprSimplifier`]
/// before calling this method to make sure the expressions can be used
for pruning.
- pub fn try_new(mut expr: Arc<dyn PhysicalExpr>, schema: SchemaRef) ->
Result<Self> {
+ pub fn try_new(expr: Arc<dyn PhysicalExpr>, schema: SchemaRef) ->
Result<Self> {
Review Comment:
Maybe as a follow on PR we want to direct people to PruningPredicateBuilder
🤔 in comments / deprecate the try_new and move this construction into the
builder
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]