Frank Chen created CALCITE-7809:
-----------------------------------

             Summary: Avoid copying unchanged SQL and Rex operands
                 Key: CALCITE-7809
                 URL: https://issues.apache.org/jira/browse/CALCITE-7809
             Project: Calcite
          Issue Type: Sub-task
            Reporter: Frank Chen


RexShuttle and SqlShuttle visit every child and return either the original 
child or a replacement. They currently copy operand collections before knowing 
whether any child changes, then discard those copies when the traversal is 
read-only.

Make these operand collections copy-on-write. Allocate only when the first 
changed child is encountered, while preserving RexShuttle's immutable-result 
contract and SqlShuttle's explicit alwaysCopy behavior.

The isolated Druid benchmark reduced allocation by 2.72% at 100,000 string 
literals and 1.55% at 1,000,000 string literals.

Pull request: [PR #5283|https://github.com/apache/calcite/pull/5283]



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to