Skip to content

Commit b634bd5

Browse files
committed
cleanup: move all Item processors together
1 parent acfc3ba commit b634bd5

File tree

1 file changed

+51
-108
lines changed

1 file changed

+51
-108
lines changed

sql/item.h

Lines changed: 51 additions & 108 deletions
Original file line numberDiff line numberDiff line change
@@ -1522,58 +1522,41 @@ class Item: public Value_source,
15221522
(*traverser)(this, arg);
15231523
}
15241524

1525-
virtual bool remove_dependence_processor(void * arg) { return 0; }
1525+
/*========= Item processors, to be used with Item::walk() ========*/
1526+
virtual bool remove_dependence_processor(void *arg) { return 0; }
15261527
virtual bool cleanup_processor(void *arg);
1527-
virtual bool collect_item_field_processor(void * arg) { return 0; }
1528-
virtual bool add_field_to_set_processor(void * arg) { return 0; }
1528+
virtual bool cleanup_excluding_const_fields_processor(void *arg) { return cleanup_processor(arg); }
1529+
virtual bool collect_item_field_processor(void *arg) { return 0; }
1530+
virtual bool collect_outer_ref_processor(void *arg) {return 0; }
1531+
virtual bool check_inner_refs_processor(void *arg) { return 0; }
15291532
virtual bool find_item_in_field_list_processor(void *arg) { return 0; }
15301533
virtual bool find_item_processor(void *arg);
1531-
virtual bool change_context_processor(void *context) { return 0; }
1532-
virtual bool reset_query_id_processor(void *query_id_arg) { return 0; }
1534+
virtual bool change_context_processor(void *arg) { return 0; }
1535+
virtual bool reset_query_id_processor(void *arg) { return 0; }
15331536
virtual bool is_expensive_processor(void *arg) { return 0; }
1537+
1538+
// FIXME reduce the number of "add field to bitmap" processors
1539+
virtual bool add_field_to_set_processor(void *arg) { return 0; }
15341540
virtual bool register_field_in_read_map(void *arg) { return 0; }
15351541
virtual bool register_field_in_write_map(void *arg) { return 0; }
1542+
virtual bool register_field_in_bitmap(void *arg) { return 0; }
1543+
virtual bool update_table_bitmaps_processor(void *arg) { return 0; }
1544+
15361545
virtual bool enumerate_field_refs_processor(void *arg) { return 0; }
15371546
virtual bool mark_as_eliminated_processor(void *arg) { return 0; }
15381547
virtual bool eliminate_subselect_processor(void *arg) { return 0; }
15391548
virtual bool set_fake_select_as_master_processor(void *arg) { return 0; }
1540-
virtual bool update_table_bitmaps_processor(void *arg) { return 0; }
15411549
virtual bool view_used_tables_processor(void *arg) { return 0; }
1542-
virtual bool eval_not_null_tables(void *opt_arg) { return 0; }
1543-
virtual bool is_subquery_processor (void *opt_arg) { return 0; }
1550+
virtual bool eval_not_null_tables(void *arg) { return 0; }
1551+
virtual bool is_subquery_processor(void *arg) { return 0; }
15441552
virtual bool count_sargable_conds(void *arg) { return 0; }
1545-
virtual bool limit_index_condition_pushdown_processor(void *opt_arg)
1546-
{
1547-
return FALSE;
1548-
}
1549-
virtual bool exists2in_processor(void *opt_arg) { return 0; }
1550-
virtual bool find_selective_predicates_list_processor(void *opt_arg)
1551-
{ return 0; }
1552-
virtual bool exclusive_dependence_on_table_processor(void *map)
1553-
{ return 0; }
1554-
virtual bool exclusive_dependence_on_grouping_fields_processor(void *arg)
1555-
{ return 0; }
1556-
virtual bool cleanup_excluding_const_fields_processor(void *arg)
1557-
{ return cleanup_processor(arg); }
1558-
1559-
virtual Item *get_copy(THD *thd, MEM_ROOT *mem_root)=0;
1560-
1561-
/* To call bool function for all arguments */
1562-
struct bool_func_call_args
1563-
{
1564-
Item *original_func_item;
1565-
void (Item::*bool_function)();
1566-
};
1567-
1568-
/*
1569-
The next function differs from the previous one that a bitmap to be updated
1570-
is passed as uchar *arg.
1571-
*/
1572-
virtual bool register_field_in_bitmap(void *arg) { return 0; }
1573-
1574-
bool cache_const_expr_analyzer(uchar **arg);
1575-
Item* cache_const_expr_transformer(THD *thd, uchar *arg);
1576-
1553+
virtual bool limit_index_condition_pushdown_processor(void *arg) { return 0; }
1554+
virtual bool exists2in_processor(void *arg) { return 0; }
1555+
virtual bool find_selective_predicates_list_processor(void *arg) { return 0; }
1556+
virtual bool exclusive_dependence_on_table_processor(void *arg) { return 0; }
1557+
virtual bool exclusive_dependence_on_grouping_fields_processor(void *arg) { return 0; }
1558+
virtual bool switch_to_nullable_fields_processor(void *arg) { return 0; }
1559+
virtual bool find_function_processor (void *arg) { return 0; }
15771560
/*
15781561
Check if a partition function is allowed
15791562
SYNOPSIS
@@ -1625,44 +1608,15 @@ class Item: public Value_source,
16251608
assumes that there are no multi-byte collations amongst the partition
16261609
fields.
16271610
*/
1628-
virtual bool check_partition_func_processor(void *bool_arg) { return TRUE;}
1629-
/*
1630-
@brief
1631-
Processor used to mark virtual columns used in partitioning expression
1632-
1633-
@param
1634-
arg always ignored
1635-
1636-
@retval
1637-
FALSE always
1638-
*/
1639-
virtual bool vcol_in_partition_func_processor(void *arg)
1640-
{
1641-
return FALSE;
1642-
}
1643-
1644-
virtual Item* propagate_equal_fields(THD*, const Context &, COND_EQUAL *)
1645-
{
1646-
return this;
1647-
};
1611+
virtual bool check_partition_func_processor(void *arg) { return 1;}
1612+
virtual bool vcol_in_partition_func_processor(void *arg) { return 0; }
1613+
/** Processor used to check acceptability of an item in the defining
1614+
expression for a virtual column
16481615
1649-
Item* propagate_equal_fields_and_change_item_tree(THD *thd,
1650-
const Context &ctx,
1651-
COND_EQUAL *cond,
1652-
Item **place);
1616+
@param arg always ignored
16531617
1654-
/*
1655-
@brief
1656-
Processor used to check acceptability of an item in the defining
1657-
expression for a virtual column
1658-
1659-
@param
1660-
arg always ignored
1661-
1662-
@retval
1663-
FALSE the item is accepted in the definition of a virtual column
1664-
@retval
1665-
TRUE otherwise
1618+
@retval 0 the item is accepted in the definition of a virtual column
1619+
@retval 1 otherwise
16661620
*/
16671621
struct vcol_func_processor_result
16681622
{
@@ -1673,20 +1627,34 @@ class Item: public Value_source,
16731627
{
16741628
return mark_unsupported_function(full_name(), arg, VCOL_IMPOSSIBLE);
16751629
}
1630+
virtual bool check_field_expression_processor(void *arg) { return 0; }
16761631

1677-
virtual bool check_field_expression_processor(void *arg) { return FALSE; }
1678-
1679-
/* arg points to REPLACE_EQUAL_FIELD_ARG object */
1680-
virtual Item *replace_equal_field(THD *thd, uchar *arg) { return this; }
16811632
/*
16821633
Check if an expression value has allowed arguments, like DATE/DATETIME
16831634
for date functions. Also used by partitioning code to reject
16841635
timezone-dependent expressions in a (sub)partitioning function.
16851636
*/
1686-
virtual bool check_valid_arguments_processor(void *bool_arg)
1637+
virtual bool check_valid_arguments_processor(void *arg) { return 0; }
1638+
/*============== End of Item processor list ======================*/
1639+
1640+
virtual Item *get_copy(THD *thd, MEM_ROOT *mem_root)=0;
1641+
1642+
bool cache_const_expr_analyzer(uchar **arg);
1643+
Item* cache_const_expr_transformer(THD *thd, uchar *arg);
1644+
1645+
virtual Item* propagate_equal_fields(THD*, const Context &, COND_EQUAL *)
16871646
{
1688-
return FALSE;
1689-
}
1647+
return this;
1648+
};
1649+
1650+
Item* propagate_equal_fields_and_change_item_tree(THD *thd,
1651+
const Context &ctx,
1652+
COND_EQUAL *cond,
1653+
Item **place);
1654+
1655+
/* arg points to REPLACE_EQUAL_FIELD_ARG object */
1656+
virtual Item *replace_equal_field(THD *thd, uchar *arg) { return this; }
1657+
16901658
struct Collect_deps_prm
16911659
{
16921660
List<Item> *parameters;
@@ -1696,31 +1664,6 @@ class Item: public Value_source,
16961664
int nest_level;
16971665
bool collect;
16981666
};
1699-
/**
1700-
Collect outer references
1701-
*/
1702-
virtual bool collect_outer_ref_processor(void *arg) {return FALSE; }
1703-
1704-
/**
1705-
Find a function of a given type
1706-
1707-
@param arg the function type to search (enum Item_func::Functype)
1708-
@return
1709-
@retval TRUE the function type we're searching for is found
1710-
@retval FALSE the function type wasn't found
1711-
1712-
@description
1713-
This function can be used (together with Item::walk()) to find functions
1714-
in an item tree fragment.
1715-
*/
1716-
virtual bool find_function_processor (void *arg)
1717-
{
1718-
return FALSE;
1719-
}
1720-
1721-
virtual bool check_inner_refs_processor(void *arg) { return FALSE; }
1722-
1723-
virtual bool switch_to_nullable_fields_processor(void *arg) { return FALSE; }
17241667

17251668
/*
17261669
For SP local variable returns pointer to Item representing its

0 commit comments

Comments
 (0)