Sergei Golubchik wrote:
> Hi!
>
> On Jul 12, will@stripped wrote:
>
>> I accidentally hit send (dur), so here's the rest of the doc:
>>
>> Each COND is a tree of conditions. The top level COND is actually an
>> Item_cond (see item_cmpfunc.h for more the class definition).
>>
>
> I don't think it's always an Item_cond, more likely it depends on your
> query. If you have WHERE a=5, for example, without AND/OR, there's no
> Item_cond in here, and unless MySQL internally creates a dummy Item_cond
> (which I don't think it does), top level COND will be Item_func_eq.
>
>
You're right, it is Item_func_eq in that case. I'll edit that in.
>> To walk
>> through the tree, you have to use the function:
>> void traverse_cond(Cond_traverser, void *arg, traverse_order order);
>> The traverse order can be postfix or prefix. MySQL cluster uses prefix
>> order which means that "WHERE row1 = 'blah' and row2 = 3" would be
>> ordered like this:
>> Item_cond_and -> Item_func_eq -> Item_field -> Item_int ->
> Item_func_eq
>> -> Item_field -> Item_string -> NULL;
>> [ed: how do i know how many arguments each item has?]
>>
>
> Base Item doesn't have arguments, Item_func does, use
> Item_func::argument_count()
>
>
Allright.
>> For more advanced condition pushdown, take a look at
>> void ndb_serialize_cond(const Item *item, void *arg)
>> in ha_ndbcluster_cond.cc
>>
>>
> Regards / Mit vielen Grüssen,
> Sergei
>
>
I'll be putting this up on the mysql internals wiki within a couple days
now, but currently I'm working on something completely different.
Thanks for the feedback!
-Will