Description
With the recent changes in the expression canonicalization, a complex query with a large number of Add operations ends up consuming 10x more memory on the executors.
The reason for this issue is that with the new changes the canonicalization process ends up generating lot of intermediate objects, especially for complex queries with a large number of commutative operators. In this specific case, a heap histogram analysis shows that a large number of Add objects use the extra memory.
This issue does not happen before PR #37851.
The high memory usage causes the executors to lose heartbeat signals and results in task failures.