Commit 347e777e authored by unknown's avatar unknown

Condition pushdown to storage engine, optimizations

parent b70b8634
...@@ -5426,8 +5426,6 @@ void ndb_serialize_cond(const Item *item, void *arg) ...@@ -5426,8 +5426,6 @@ void ndb_serialize_cond(const Item *item, void *arg)
if (context->table == field->table) if (context->table == field->table)
{ {
const NDBTAB *tab= (const NDBTAB *) context->ndb_table; const NDBTAB *tab= (const NDBTAB *) context->ndb_table;
const NDBCOL *col= tab->getColumn(field->field_name);
DBUG_ASSERT(col);
DBUG_PRINT("info", ("FIELD_ITEM")); DBUG_PRINT("info", ("FIELD_ITEM"));
DBUG_PRINT("info", ("table %s", tab->getName())); DBUG_PRINT("info", ("table %s", tab->getName()));
DBUG_PRINT("info", ("column %s", field->field_name)); DBUG_PRINT("info", ("column %s", field->field_name));
...@@ -5442,6 +5440,8 @@ void ndb_serialize_cond(const Item *item, void *arg) ...@@ -5442,6 +5440,8 @@ void ndb_serialize_cond(const Item *item, void *arg)
*context->supported_ptr= FALSE; *context->supported_ptr= FALSE;
else else
{ {
const NDBCOL *col= tab->getColumn(field->field_name);
DBUG_ASSERT(col);
curr_cond->ndb_item= new Ndb_item(field, col->getColumnNo()); curr_cond->ndb_item= new Ndb_item(field, col->getColumnNo());
context->dont_expect(Item::FIELD_ITEM); context->dont_expect(Item::FIELD_ITEM);
context->expect_no_field_result(); context->expect_no_field_result();
......
...@@ -2044,12 +2044,21 @@ void Item_cond::traverse_cond(Item_cond_traverser traverser, ...@@ -2044,12 +2044,21 @@ void Item_cond::traverse_cond(Item_cond_traverser traverser,
List_iterator<Item> li(list); List_iterator<Item> li(list);
Item *item; Item *item;
if (order == PREFIX) (*traverser)(this, arg); switch(order) {
while ((item= li++)) case(PREFIX):
{ (*traverser)(this, arg);
item->traverse_cond(traverser, arg, order); while ((item= li++))
{
item->traverse_cond(traverser, arg, order);
}
break;
case(POSTFIX):
while ((item= li++))
{
item->traverse_cond(traverser, arg, order);
}
(*traverser)(this, arg);
} }
if (order == POSTFIX) (*traverser)(this, arg);
} }
void Item_cond::split_sum_func(THD *thd, Item **ref_pointer_array, void Item_cond::split_sum_func(THD *thd, Item **ref_pointer_array,
......
...@@ -349,13 +349,23 @@ void Item_func::traverse_cond(Item_cond_traverser traverser, ...@@ -349,13 +349,23 @@ void Item_func::traverse_cond(Item_cond_traverser traverser,
if (arg_count) if (arg_count)
{ {
Item **arg,**arg_end; Item **arg,**arg_end;
if (order == PREFIX) (traverser)(this, argument);
for (arg= args, arg_end= args+arg_count; arg != arg_end; arg++) switch (order) {
{ case(PREFIX):
(*arg)->traverse_cond(traverser, argument, order); (traverser)(this, argument);
for (arg= args, arg_end= args+arg_count; arg != arg_end; arg++)
{
(*arg)->traverse_cond(traverser, argument, order);
}
break;
case (POSTFIX):
for (arg= args, arg_end= args+arg_count; arg != arg_end; arg++)
{
(*arg)->traverse_cond(traverser, argument, order);
}
(traverser)(this, argument);
} }
} }
if (order == POSTFIX) (traverser)(this, argument);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment