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

   @terrymanu Thanks, both are fixed in the latest commit.
   
   When a derived table renames a physical column, as in `SELECT d.n FROM 
(SELECT id AS n FROM foo_tbl) d`, the outer column doesn't go through the 
origin lookup, so it fell back to the physical name. Now, if the outer column 
label differs from the original column name, it's sent as the alias. I added a 
test that selects `d.n` and `d.*` from that derived table and checks both are 
described as `n`.
   
   For the cost, the shorthand-expanded column set and a label to projection 
map are now built once per source select and cached for the prepare request. 
The per-column lookup no longer rebuilds or scans the source projection list. I 
compared `SELECT d.* FROM (SELECT 0 AS c0, ...) d` with the same select without 
the derived table: the extra allocation was about 1.8, 3.4 and 6.9 MB at 640, 
1280 and 2560 columns, so it grows linearly now.


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