thswlsqls commented on PR #40071:
URL: https://github.com/apache/shardingsphere/pull/40071#issuecomment-6250245228

   @terrymanu Thanks for the review. You're right — `Iterables.getLast` 
collapsed same-name tables that share one key within a scope. The owner lookup 
now walks that owner's outer contexts from the nearest scope outward and takes 
the first one that has the column, the same rule 
`findInputColumnSegmentFromOuterTable` uses for unqualified names. 
`assertBindWithExistsSubqueryReferencingSameNameTableInOuterScope` covers 
`SELECT status FROM foo_db.t_order, bar_db.t_order WHERE EXISTS (SELECT 
foo_db.t_order.status FROM t_user)` and fails on the previous head; the 
alias-shadowing tests still pass.
   
   One difference from strict nesting-level resolution: if the nearest `t` 
lacks the column, a farther `t` that has it is used instead of failing, since 
the merged outer contexts carry no scope boundary. Tracking scope levels would 
need a structural change across the binders, so I kept the fix local — happy to 
go further if you prefer.
   


-- 
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]

Reply via email to