wirybeaver commented on PR #20763: URL: https://github.com/apache/datafusion/pull/20763#issuecomment-4715840167
**Note on `Box<MergeIntoOp>` in `WriteOp::MergeInto`** `MergeIntoOp` contains an `Expr` (the `ON` condition) and a `Vec<MergeIntoClause>`, making it significantly larger than the other `WriteOp` variants. Storing it inline would increase every `LogicalPlan` node's size (the `Dml` variant contributes to the enum discriminant size), blowing the `LogicalPlan` enum from 176 → 240 bytes — a regression caught by the `test_size_of_logical_plan` guard added recently to `plan.rs`. Boxing allocates `MergeIntoOp` on the heap so only an 8-byte pointer lives inside the enum. The same pattern is already used by `DdlStatement` for `CreateExternalTable` and `CreateFunction`, and the `test_size_of_logical_plan` test explicitly checks that those remain boxed. There is no memory leak risk — Rust drops the `Box` automatically when the `WriteOp` goes out of scope. -- 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
