Steve Carlin has posted comments on this change. ( http://gerrit.cloudera.org:8080/23209 )
Change subject: IMPALA-13767: Do not treat CTEs as names of actual tables ...................................................................... Patch Set 3: (2 comments) http://gerrit.cloudera.org:8080/#/c/23209/3/java/calcite-planner/src/main/java/org/apache/impala/calcite/service/CalciteMetadataHandler.java File java/calcite-planner/src/main/java/org/apache/impala/calcite/service/CalciteMetadataHandler.java: http://gerrit.cloudera.org:8080/#/c/23209/3/java/calcite-planner/src/main/java/org/apache/impala/calcite/service/CalciteMetadataHandler.java@191 PS3, Line 191: public LinkedList<SqlNode> currentlyVisitedSqlNodes = new LinkedList<>(); > > 1) Instead of type SqlNode, we can use type SqlWith, since it will only c Ugh. I figured LinkedHashMap would have a method to do this, but i guess not. But I do have another idea to float by you! So as mentioned before, we no longer need "closestSqlWith" because it is the most recent entry. But we also don't really need to track the "SqlWith" node either! So a Stack might be perfect for us after all? What if we had a Stack<Set<TableName>> variable. When we see a new SqlWith, we push an empty Set<TableName> onto the stack. When we need to add a new SqlWithItem, we "peek" onto the stack and add it into the top level. The "isRegistered" method doesn't care on the order (nor does it care about which SqlWith is used), so we can use any iterator. And we call "pop" instead of "removeLast" Whatcha think? http://gerrit.cloudera.org:8080/#/c/23209/3/java/calcite-planner/src/main/java/org/apache/impala/calcite/service/CalciteMetadataHandler.java@202 PS3, Line 202: currentlyVisitedSqlNodes.add(call); > > This is still putting all SqlCalls into currentlyVisitedSqlNodes_. I don't know how I missed this. My bad. Looks good as/is. Sorry! -- To view, visit http://gerrit.cloudera.org:8080/23209 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-Project: Impala-ASF Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: I3f51af42d64cdcff3c26ad5a96c7f53ebef431b3 Gerrit-Change-Number: 23209 Gerrit-PatchSet: 3 Gerrit-Owner: Fang-Yu Rao <fangyu....@cloudera.com> Gerrit-Reviewer: Aman Sinha <amsi...@cloudera.com> Gerrit-Reviewer: Fang-Yu Rao <fangyu....@cloudera.com> Gerrit-Reviewer: Impala Public Jenkins <impala-public-jenk...@cloudera.com> Gerrit-Reviewer: Joe McDonnell <joemcdonn...@cloudera.com> Gerrit-Reviewer: Michael Smith <michael.sm...@cloudera.com> Gerrit-Reviewer: Riza Suminto <riza.sumi...@cloudera.com> Gerrit-Reviewer: Steve Carlin <scar...@cloudera.com> Gerrit-Comment-Date: Thu, 04 Sep 2025 12:46:15 +0000 Gerrit-HasComments: Yes