Hi!
>>>>> "Sinisa" == Sinisa Milivojevic <sinisa@stripped> writes:
Sinisa> On Fri, 21 Dec 2001 15:13:32 +0530 (IST)
Sinisa> Sri <lakshmi@stripped> wrote:
>>
>>
>> Could anyone please explain me how the group_list and item_list
>> are filled in while executing a select statement.
>>
>> Thanking you in anticipation.
>>
>> Srilakshmi.
>>
Sinisa> Hi!
Sinisa> Take a look at add_item_to_list() function.
To be a little more precise:
All group's are added added at this point in sql_yacc.yy:
group_list:
group_list ',' order_ident order_dir
{ if (add_group_to_list($3,(bool) $4)) YYABORT; }
| order_ident order_dir
{ if (add_group_to_list($1,(bool) $2)) YYABORT; }
All lists are stored in the thd->lex structure, defined in
sql_lex.h
You can find all the MySQL specific list-adding functions like
add_group_to_list in sql_parse.cc.
The list and iterators are defined in sql_list.h.
I would recommend you to start looking at sql_list.h to understand the
basic list functions (they are very simple).
For an example of how to create a GROUP BY list of items, take a look in
sql_select.cc at:
static ORDER *create_distinct_group(ORDER *order_list,List<Item> &fields)
After you got a grasp of how the lists and the items works, you should be
able to relatively easily implement CUBE, as you described in your
previous email.
Regards,
Monty