HanumathRao commented on code in PR #3640:
URL: https://github.com/apache/calcite/pull/3640#discussion_r1459968138
##########
core/src/main/java/org/apache/calcite/prepare/Prepare.java:
##########
@@ -293,13 +293,6 @@ public PreparedResult prepareSql(
root = root.withRel(decorrelate(sqlToRelConverter, sqlQuery, root.rel));
}
- if (configHolder.get().isTrimUnusedFields()) {
Review Comment:
The TrimUnusedFields function currently lacks comprehensive handling for
cases involving correlation variables. It appears that the trimUnusedFields in
the Prepare call was retained for legacy use cases, where a config object with
trimUnusedFields can be set to True. However, upon inspecting the code at
[link](https://github.com/apache/calcite/blob/main/core/src/main/java/org/apache/calcite/prepare/PlannerImpl.java#L265),
trimUnusedFields is set to False, and a series of optimizations are applied to
the RelNodeTree. Subsequently, the TrimUnusedFields Program is executed on the
RelNodeTree in a later part of the code path. Therefore, the proposed change
aims to synchronize these two code paths.
It's worth noting that addressing this issue is complex due to the interplay
of seemingly disparate changes that contribute to encountering various
problems. While I appreciate your questions and engagement, I believe
consulting an expert in this domain would be beneficial to ensure the
correctness of my proposal and explore any potential alternative solutions to
resolve this issue. Thank you for your understanding.
--
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]