[ https://issues.apache.org/jira/browse/CALCITE-5061?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17534476#comment-17534476 ]
Thomas Rebele edited comment on CALCITE-5061 at 5/11/22 8:55 AM: ----------------------------------------------------------------- The problem with the RelFieldTrimmer is that it abandons trimming in some cases if it encounters a non-trimmable node, even if it would be helpful to trim the children. Field trimming can be applied to UNION-all as well under certain circumstances. However this is out of scope for the current ticket. I might create a PR for UNION-all trimming later. I've pushed a first draft of the alternative trimmer to [https://github.com/thomasrebele/calcite/tree/CALCITE-5061]. I still need to complete the implementation for Calcite (extra fields, some node types, such as Exchange). Feel free to take a look in the meantime. was (Author: thomas.rebele): The problem with the RelFieldTrimmer is that it abandons trimming in some cases if it encounters a non-trimmable node, even if it would be helpful to trim the children. Field trimming can be applied to UNION-all as well under certain circumstances. However this is out of scope for the current ticket. I might create a PR for UNION-all trimming later. I've pushed a first draft of the alternative trimmer to [https://github.com/thomasrebele/calcite/tree/CALCITE-5061.] I still need to complete the implementation for Calcite (extra fields, some node types, such as Exchange). Feel free to take a look in the meantime. > Improve recursive application of the field trimming > --------------------------------------------------- > > Key: CALCITE-5061 > URL: https://issues.apache.org/jira/browse/CALCITE-5061 > Project: Calcite > Issue Type: Improvement > Reporter: Thomas Rebele > Assignee: Thomas Rebele > Priority: Major > Fix For: 1.31.0 > > > The RelFieldTrimmer has some shortcomings: > * If the plan contains certain set ops (e.g., UNION(all=false)), even if the > operator needs all fields for the correct result (CALCITE-3399), it may still > make sense to apply the trimming to the children. See CALCITE-5051 for an > example. > * Same applies for a Sort with dynamic parameters in the fetch/offset, and > RepeatUnions > * The makeZeroLiteral logic in trimChildRestore(...) does not work for ARRAY > / Java types. -- This message was sent by Atlassian Jira (v8.20.7#820007)