sunchao commented on code in PR #5699:
URL: https://github.com/apache/datafusion-comet/pull/5699#discussion_r3942277415


##########
native/core/src/execution/operators/dynamic_filter.rs:
##########
@@ -0,0 +1,525 @@
+// 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.
+
+//! Connect a hash join's completed build domain to its probe input.
+//!
+//! Comet does not run DataFusion's physical optimizer, which normally connects
+//! dynamic-filter producers and consumers. This targeted wiring filters probe
+//! batches and lets a direct Parquet reader use the same live predicate for
+//! pruning. The original join verifies matches, including hash collisions.
+//! This leaves Spark's operator tree and partitioning intact and does
+//! not cross Spark exchanges or JVM/Arrow boundaries.
+
+use std::fmt::Formatter;
+use std::sync::Arc;
+
+use arrow::compute::filter_record_batch;
+use arrow::datatypes::DataType;
+use datafusion::common::cast::as_boolean_array;
+use datafusion::common::config::ConfigOptions;
+use datafusion::common::{internal_err, JoinType, NullEquality, Result, 
ScalarValue, Statistics};
+use datafusion::datasource::physical_plan::ParquetSource;
+use datafusion::datasource::source::DataSourceExec;
+use datafusion::execution::TaskContext;
+use datafusion::logical_expr::{ColumnarValue, Operator};
+use datafusion::physical_expr::expressions::{
+    lit, BinaryExpr, Column, DynamicFilterPhysicalExpr, IsNotNullExpr,
+};
+use datafusion::physical_expr::PhysicalExpr;
+use datafusion::physical_plan::execution_plan::CardinalityEffect;
+use datafusion::physical_plan::joins::{HashJoinExec, PartitionMode};
+use datafusion::physical_plan::metrics::{ExecutionPlanMetricsSet, 
MetricBuilder, MetricsSet};
+use datafusion::physical_plan::stream::RecordBatchStreamAdapter;
+use datafusion::physical_plan::{
+    DisplayAs, DisplayFormatType, Distribution, ExecutionPlan, 
ExecutionPlanProperties,
+    PlanProperties, SendableRecordBatchStream,
+};
+use futures::StreamExt;
+
+use super::CometFilterExec;
+
+/// A task-local consumer of DataFusion's build-side runtime filter.
+#[derive(Debug)]
+pub(crate) struct DynamicFilterExec {
+    input: Arc<dyn ExecutionPlan>,
+    predicate: Arc<DynamicFilterPhysicalExpr>,
+    metrics: ExecutionPlanMetricsSet,
+}
+
+impl DynamicFilterExec {
+    fn new(input: Arc<dyn ExecutionPlan>, predicate: 
Arc<DynamicFilterPhysicalExpr>) -> Self {
+        Self {
+            input,
+            predicate,
+            metrics: ExecutionPlanMetricsSet::new(),
+        }
+    }
+}
+
+impl DisplayAs for DynamicFilterExec {
+    fn fmt_as(&self, _t: DisplayFormatType, f: &mut Formatter) -> 
std::fmt::Result {
+        write!(f, "CometDynamicFilterExec")
+    }
+}
+
+impl ExecutionPlan for DynamicFilterExec {

Review Comment:
   ### Correctness
   
   **[P1] Adapt the wrappers and tests to the current DataFusion integration**
   
   Could we update these implementations for DataFusion 55 before merging? The 
[current Rust 
job](https://github.com/apache/datafusion-comet/actions/runs/33995365059/job/101385223231)
 actually checks out `512ddb6ad3fedaba3d1874fb4b86cc2e619a3cdf`, with parents 
`c348f775` and `fb4f75c6`. It reports missing `apply_expressions` 
implementations for `DynamicFilterExec`, `DynamicFilterJoinExec` and 
`CometFilterExec`. Clippy also rejects obsolete API calls, including the moved 
planner call, and the reader test still uses unavailable `inner()` and 
`remapped_children()` accessors. The job exits before runtime tests.
   
   The dynamic-filter files and `filter.rs` are byte-identical between this 
head and the executed merge, and the moved planner helper and its call sites 
also match. These implementations still need the API migration for this 
integration to build. The assigned `719cba11` pair retains DataFusion 54.1.0, 
so older passing results do not qualify the newer-base DataFusion 55 build.
   



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