Skip to content

Derive Clone for more ExecutionPlans #13202

@alamb

Description

@alamb

Is your feature request related to a problem or challenge?

In our code / optimizers we have a lot of code that looks like this when we are
trying to rewrite a SortExec node by making a copy and changing only some of the
fields. For example:

     new_plan = Ok(Arc::new(
                SortExec::new(sort_exec.expr().to_vec(), Arc::clone(sort_exec.input()))
                    .with_fetch(sort_exec.fetch())
                    .with_preserve_partitioning(true),
            ));

This is problematic and we have had bugs in the past when SortExec got a new field (like fetch)

We would like to simply be able to make a copy and modify appropriately:

     new_plan = Ok(Arc::new(sort_exec.clone().with_preserve_partitioning(true)));

Many ExecutionPlans like ParquetExec already implement Clone so it is nice to
make the rest consistent

Describe the solution you'd like

I would like to derive Clone for other plans

Describe alternatives you've considered

No response

Additional context

No response

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions