[
https://issues.apache.org/jira/browse/CALCITE-7809?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Frank Chen updated CALCITE-7809:
--------------------------------
Description:
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 when the first changed
child is encountered, or during result construction when SqlShuttle.alwaysCopy
requires a new call, while preserving RexShuttle’s immutable-result contract.
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]
was:
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]
> 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
> Priority: Major
> Labels: pull-request-available
>
> 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 when the first changed
> child is encountered, or during result construction when
> SqlShuttle.alwaysCopy requires a new call, while preserving RexShuttle’s
> immutable-result contract.
> 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)