schizophrenicmaniac commented on PR #40294:
URL: https://github.com/apache/shardingsphere/pull/40294#issuecomment-6338703748

   @terrymanu Thanks, all three are fixed in the latest commit.
   
   For `SELECT a.* FROM foo_cte a`, the expanded columns carry the CTE name as 
owner rather than the alias. The lookup still matches the owner against the 
alias or name first. Only when nothing matches does it fall back to the table 
name of an aliased source, so explicit aliases keep priority.
   
   Derived tables are now followed like CTEs. The column is matched in the 
subquery's projections and traced further through its FROM with the same CTE 
scope, and the outer label is kept. For the outer case, `getProjections` used 
to merge the projections of every subquery context, CTE bodies included, so 
`SELECT d.n FROM (SELECT n FROM foo_cte) d` described two columns. It now only 
takes the context of the derived table in FROM, and the CTE lookup resolves 
against that subquery's SELECT. I added tests for `foo_alias.*` on a CTE, a 
derived table inside a CTE, and a derived table selecting from a CTE.
   
   The `flatMap` lambdas no longer use `optional`.


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