Skip to content

Commit 901aaca

Browse files
authored
chore: remove redundant clone code (#18997)
## 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. --> It's very simple, do I need to propose an issue? - Closes #. ## Rationale for this change <!-- 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. --> We don't need to clone `ExectuionPlan` when `repartitioned()` didn't happened. ## What changes are included in this PR? <!-- 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. --> Very simple, just remove extra `clone()`. ## Are these changes tested? <!-- 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)? --> Compile passed. ## Are there any user-facing changes? <!-- 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. --> No Signed-off-by: Smith Cruise <chendingchao1@126.com>
1 parent 6425e40 commit 901aaca

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

datafusion/datasource/src/source.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -263,17 +263,15 @@ impl ExecutionPlan for DataSourceExec {
263263
self.properties().eq_properties.output_ordering(),
264264
)?;
265265

266-
if let Some(source) = data_source {
266+
Ok(data_source.map(|source| {
267267
let output_partitioning = source.output_partitioning();
268268
let plan = self
269269
.clone()
270270
.with_data_source(source)
271271
// Changing source partitioning may invalidate output partitioning. Update it also
272272
.with_partitioning(output_partitioning);
273-
Ok(Some(Arc::new(plan)))
274-
} else {
275-
Ok(Some(Arc::new(self.clone())))
276-
}
273+
Arc::new(plan) as _
274+
}))
277275
}
278276

279277
fn execute(

0 commit comments

Comments
 (0)