Skip to content

Commit a3b3eb5

Browse files
bug: Eliminate dead round-robin insertion in enforce distribution (#19132)
## Which issue does this PR close? <!-- We generally require a GitHub issue to be filed for all bug fixes and enhancements and this helps us generate change logs for our releases. You can link an issue to this PR using the GitHub syntax. For example `Closes #123` indicates that this PR will close issue #123. --> - Closes #19131. ## Rationale for this change Eliminates dead code that was not used in the enforce distribution rule. In the branch where a parent requires hash repartitioning, there was a condition that would "add" a round robin if hash was not necessary (already hashed correctly) and the add round-robin flag was marked as true. This condition would never evaluate to true because anytime a parent requires hash repartitioning, we cannot round-robin because it would break the hash partitioning. <!-- Why are you proposing this change? If this is already explained clearly in the issue then this section is not needed. Explaining clearly why changes are proposed helps reviewers understand your changes and offer better suggestions for fixes. --> ## What changes are included in this PR? A condition is deleted. No tests or plans were changed since this was dead code. <!-- There is no need to duplicate the description in the issue here but it is sometimes worth providing a summary of the individual changes in this PR. --> ## Are these changes tested? Yes, all tests (unit and sqllogictests) still pass. There is no new tests to add. <!-- We typically require tests for all PRs in order to: 1. Prevent the code from being accidentally broken by subsequent changes 2. Serve as another way to document the expected behavior of the code If tests are not included in your PR, please explain why (for example, are they covered by existing tests)? --> ## Are there any user-facing changes? No. <!-- If there are user-facing changes then we may require documentation to be updated before approving the PR. --> <!-- If there are any breaking changes to public APIs, please add the `api change` label. --> Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
1 parent 33b3f02 commit a3b3eb5

File tree

1 file changed

+0
-5
lines changed

1 file changed

+0
-5
lines changed

datafusion/physical-optimizer/src/enforce_distribution.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1274,11 +1274,6 @@ pub fn ensure_distribution(
12741274
}
12751275
Distribution::HashPartitioned(exprs) => {
12761276
// See https://github.com/apache/datafusion/issues/18341#issuecomment-3503238325 for background
1277-
if add_roundrobin && !hash_necessary {
1278-
// Add round-robin repartitioning on top of the operator
1279-
// to increase parallelism.
1280-
child = add_roundrobin_on_top(child, target_partitions)?;
1281-
}
12821277
// When inserting hash is necessary to satisfy hash requirement, insert hash repartition.
12831278
if hash_necessary {
12841279
child =

0 commit comments

Comments
 (0)