WL#13990: Unify the two field lists in SELECT_LEX
Affects: Server-8.0 — Status: Complete
In SELECT_LEX, unify fields_list (visible fields) and all_fields (visible _and_ invisible fields); before this WL, they were overlapping linked lists (except in a few cases where they were not, undocumented). This is necessary but not sufficient to be able to have visible and invisible items in arbitrary order; in order to get that, we will also need to remove most cases of thd->change_item_tree(), and a few other things, detailed in comments. However, this is a good cleanup in itself, and enables us to use e.g. range-based for loops in a number of places. The new data structure is a std::deque of Item *, which has much less confusing semantics, is more cache-efficient and also works without constant pointer chasing. (Ideally, we'd move towards a Mem_root_array, but cannot do it before the aforementioned changes.) This type change propagates far into the code, but is mostly localized to the optimizer. (It removes about 80% of all instances of List<Item>, which is a good step on the way to removing List<T> entirely.) Item has received a boolean that signifies whether it is hidden or not, and many loops that iterated over fields_list now check this flag and skip hidden ones.
No new functional requirements. Performance should not regress.
Copyright (c) 2000, 2020, Oracle Corporation and/or its affiliates. All rights reserved.