Skip to content

⚡ Bolt: optimize logical2physical to avoid Schema deep copy#276

Open
Dandandan wants to merge 1 commit intomainfrom
bolt/optimize-logical2physical-1702757292747917788
Open

⚡ Bolt: optimize logical2physical to avoid Schema deep copy#276
Dandandan wants to merge 1 commit intomainfrom
bolt/optimize-logical2physical-1702757292747917788

Conversation

@Dandandan
Copy link
Copy Markdown
Owner

The optimization improves logical2physical by accepting &SchemaRef (&Arc<Schema>) instead of &Schema. This allows the function to use Arc::clone rather than a deep copy of the schema's fields. I have also updated all call sites in the repository to accommodate this change, ensuring that they either pass existing SchemaRefs or wrap owned Schemas in an Arc. Tests for datafusion-physical-expr, datafusion-datasource-parquet, and datafusion-pruning have been run and passed.


PR created automatically by Jules for task 1702757292747917788 started by @Dandandan

This optimization modifies `logical2physical` to accept `&SchemaRef` instead of `&Schema`.
By doing so, it avoids a deep copy of the Arrow schema's fields when converting to `DFSchema`.
The existing implementation triggered a deep copy because it only had a reference to the `Schema` and needed an owned `Arc<Schema>` to create a `DFSchema`.

Impact: Reduces CPU and memory overhead when creating physical expressions from logical ones, especially in contexts with many expressions or large schemas (e.g. Parquet scan predicates).

Measurement: Verified with existing tests and `cargo check`. The optimization addresses a long-standing `TODO` in the codebase.

Co-authored-by: Dandandan <163737+Dandandan@users.noreply.github.com>
@google-labs-jules
Copy link
Copy Markdown

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant