Skip to content

Commit 1cbed0b

Browse files
committed
fix
1 parent cdd9f6d commit 1cbed0b

File tree

2 files changed

+14
-12
lines changed

2 files changed

+14
-12
lines changed

datafusion/datasource-parquet/src/opener.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -550,7 +550,8 @@ impl FilePruner {
550550
.with_metadata(logical_file_schema.metadata().clone()),
551551
);
552552
Ok(Self {
553-
predicate_generation: snapshot_generation(&predicate),
553+
// Initialize the predicate generation to 0 so that the first time we call `should_prune` we actually check the predicate
554+
predicate_generation: 0,
554555
predicate,
555556
pruning_schema,
556557
file,

datafusion/physical-expr/src/expressions/dynamic_filters.rs

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ pub struct DynamicFilterPhysicalExpr {
5454
#[derive(Debug)]
5555
struct Inner {
5656
/// A counter that gets incremented every time the expression is updated so that we can track changes cheaply.
57-
/// This is used for [`PhysicalExpr::generation`] to have a cheap check for changes.
57+
/// This is used for [`PhysicalExpr::snapshot_generation`] to have a cheap check for changes.
5858
generation: u64,
5959
expr: Arc<dyn PhysicalExpr>,
6060
}
@@ -169,16 +169,17 @@ impl DynamicFilterPhysicalExpr {
169169
/// This will return the current expression with any children
170170
/// remapped to match calls to [`PhysicalExpr::with_new_children`].
171171
pub fn current(&self) -> Result<Arc<dyn PhysicalExpr>> {
172-
let inner = self
173-
.inner
174-
.read()
175-
.map_err(|_| {
176-
datafusion_common::DataFusionError::Execution(
177-
"Failed to acquire read lock for inner".to_string(),
178-
)
179-
})?
180-
.expr
181-
.clone();
172+
let inner = Arc::clone(
173+
&self
174+
.inner
175+
.read()
176+
.map_err(|_| {
177+
datafusion_common::DataFusionError::Execution(
178+
"Failed to acquire read lock for inner".to_string(),
179+
)
180+
})?
181+
.expr,
182+
);
182183
let inner =
183184
Self::remap_children(&self.children, self.remapped_children.as_ref(), inner)?;
184185
Ok(inner)

0 commit comments

Comments
 (0)