Kontinuation commented on code in PR #677: URL: https://github.com/apache/sedona-db/pull/677#discussion_r2878485149
########## rust/sedona-spatial-join/src/planner/probe_shuffle_exec.rs: ########## @@ -0,0 +1,225 @@ +// 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. + +//! [`ProbeShuffleExec`] — a round-robin repartitioning wrapper that is invisible +//! to DataFusion's `EnforceDistribution` / `EnforceSorting` optimizer passes. +//! +//! Those passes unconditionally strip every [`RepartitionExec`] before +//! re-evaluating distribution requirements. Because `SpatialJoinExec` reports +//! `UnspecifiedDistribution` for its inputs, a bare `RepartitionExec` that was +//! inserted by the extension planner is removed and never re-added. +//! +//! `ProbeShuffleExec` wraps a hidden, internal `RepartitionExec` so that: +//! * **Optimizer passes** see an opaque node (not a `RepartitionExec`) and leave +//! it alone. +//! * **`children()` / `with_new_children()`** expose the *original* input so +//! the rest of the optimizer tree can still be rewritten normally. +//! * **`execute()`** delegates to the internal `RepartitionExec` which performs +//! the actual round-robin shuffle. + +use std::any::Any; +use std::fmt; +use std::sync::Arc; + +use datafusion_common::config::ConfigOptions; +use datafusion_common::{internal_err, plan_err, Result, Statistics}; +use datafusion_execution::{SendableRecordBatchStream, TaskContext}; +use datafusion_physical_expr::PhysicalExpr; +use datafusion_physical_plan::execution_plan::CardinalityEffect; +use datafusion_physical_plan::filter_pushdown::{ + ChildPushdownResult, FilterDescription, FilterPushdownPhase, FilterPushdownPropagation, +}; +use datafusion_physical_plan::metrics::MetricsSet; +use datafusion_physical_plan::projection::ProjectionExec; +use datafusion_physical_plan::repartition::RepartitionExec; +use datafusion_physical_plan::{ + DisplayAs, DisplayFormatType, ExecutionPlan, ExecutionPlanProperties, Partitioning, + PlanProperties, +}; + Review Comment: This is incorrect. Calling `output_partitioning` method needs to import this trait. -- 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]
