Under terms of this task we'll do two things:
- Join classes select_handler and Pushdown_select into a single class
The current implementation with two parallel classes (select_handler and Pushdown_select) is hard to follow. Non of them can work without the other. The two-step construction stage looks too complex:
With a single object it will be as simple as:
The destruction stage looks dangerous in the current implementation:
So the server deletes a Pushdown_select instance, which then deletes the select_handler. It's much safer just to delete a single object.
- Make it possible for the engine (e.g. XPand) to create a TABLE on its own and then reuse it during select_handler() creation time by assigning to select_handler::table. This is needed to avoid two executions of create_tmp_table() which currenly happen with XPand. So during the preparation stage, the TABLE will already be assigned to select_handler::table and select_handler will not need to make it again during the preparation stage. The method will looks about like this:
Notice, in the new reduction, the table is created only if select_handler::table is NULL.