I’ve done some investigating, and it seems that this is due to the rule being applied top-down (w.r.t. the nesting of subqueries). https://issues.apache.org/jira/browse/CALCITE-5213?focusedCommentId=17876825&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-17876825
On 2024/08/20 16:22:34 Ian Bertolacci wrote: > Hello, JIRA CALCITE-5213 has been open for a while now and still seems to be > an issue. > I’ve included small example which demonstrates the issue. > I’m hoping someone can figure out what might be happening here (hopefully I’m > just doing something wrong) and see if there are possible solutions. > Thanks! > -Ian J. Bertolacci > > >