adriangb commented on code in PR #22348:
URL: https://github.com/apache/datafusion/pull/22348#discussion_r3263622271


##########
datafusion/datasource-parquet/src/bloom_filter.rs:
##########
@@ -0,0 +1,192 @@
+// 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.
+
+//! Loaded Parquet Split Block Bloom Filter (SBBF) data, with a
+//! [`PruningStatistics`] adapter so the predicate-pruning machinery in
+//! [`datafusion_pruning`] can consume it.
+
+use std::collections::{HashMap, HashSet};
+
+use arrow::array::{ArrayRef, BooleanArray};
+use datafusion_common::pruning::PruningStatistics;
+use datafusion_common::{Column, ScalarValue};
+use parquet::basic::Type;
+use parquet::bloom_filter::Sbbf;
+use parquet::data_type::Decimal;
+
+/// In memory Parquet Split Block Bloom Filters (SBBF).
+///
+/// This structure implements [`PruningStatistics`] and is used to prune
+/// Parquet row groups and data pages based on the query predicate.
+#[derive(Debug, Clone, Default)]
+pub(crate) struct BloomFilterStatistics {
+    /// Per-column Bloom filters
+    /// Key: predicate column name
+    /// Value:
+    /// * [`Sbbf`] (Bloom filter),
+    /// * Parquet physical [`Type`] needed to evaluate  literals against the 
filter
+    pub(crate) column_sbbf: HashMap<String, (Sbbf, Type)>,

Review Comment:
   Good call — dropped it. Done across three follow-up commits:
   
   - `13379592a3` builds `BloomFilterStatistics` via its 
`with_capacity`/`insert` constructors in the test (the pattern `opener.rs` 
already uses) instead of a struct literal, so `column_sbbf` stays a private 
field.
   - `5089cf49e6` extracts `ExpectedPruning` — the one test helper shared with 
the row-group tests — into a new `#[cfg(test)] mod test_util`.
   - `f232e73811` moves the bloom-filter tests (`test_row_group_bloom_*`, 
`BloomFilterTest`, and the helper) into `bloom_filter.rs`, next to the code 
they exercise.
   
   The only visibility addition is a `#[cfg(test)] pub(crate) fn access_plan()` 
accessor on `RowGroupAccessPlanFilter`, so the shared `ExpectedPruning` 
assertion can run from a sibling module without exposing the field itself.



-- 
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]

Reply via email to