List:Internals« Previous MessageNext Message »
From:Sergei Golubchik Date:July 13 2007 7:43am
Subject:Re: My attempt at documenting condition pushdown SE implementation (part 2)
View as plain text  
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.

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

> 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

-- 
   __  ___     ___ ____  __
  /  |/  /_ __/ __/ __ \/ /   Sergei Golubchik <serg@stripped>
 / /|_/ / // /\ \/ /_/ / /__  Principal Software Developer
/_/  /_/\_, /___/\___\_\___/  MySQL GmbH, Radlkoferstr. 2, D-81373 München
       <___/                  Geschäftsführer: Kaj Arnö - HRB
München 162140
Thread
My attempt at documenting condition pushdown SE implementation (part2)will@delgenio.com12 Jul
  • Re: My attempt at documenting condition pushdown SE implementation (part 2)Sergei Golubchik13 Jul
    • Re: My attempt at documenting condition pushdown SE implementation(part 2)will@delgenio.com17 Jul