Commit 33057798 authored by Varun Gupta's avatar Varun Gupta

has_error field added to the item_sum class. This field ensures that query is terminated

if we get any error during the add function call. This is currently used only for the
percentile functions
parent 64a2a302
...@@ -441,6 +441,7 @@ Item_sum::Item_sum(THD *thd, List<Item> &list): Item_func_or_sum(thd, list) ...@@ -441,6 +441,7 @@ Item_sum::Item_sum(THD *thd, List<Item> &list): Item_func_or_sum(thd, list)
mark_as_sum_func(); mark_as_sum_func();
init_aggregator(); init_aggregator();
list.empty(); // Fields are used list.empty(); // Fields are used
has_error= FALSE;
} }
...@@ -452,7 +453,7 @@ Item_sum::Item_sum(THD *thd, Item_sum *item): ...@@ -452,7 +453,7 @@ Item_sum::Item_sum(THD *thd, Item_sum *item):
Item_func_or_sum(thd, item), Item_func_or_sum(thd, item),
aggr_sel(item->aggr_sel), aggr_sel(item->aggr_sel),
nest_level(item->nest_level), aggr_level(item->aggr_level), nest_level(item->nest_level), aggr_level(item->aggr_level),
quick_group(item->quick_group), quick_group(item->quick_group), has_error(FALSE),
orig_args(NULL) orig_args(NULL)
{ {
if (arg_count <= 2) if (arg_count <= 2)
......
...@@ -367,6 +367,7 @@ class Item_sum :public Item_func_or_sum ...@@ -367,6 +367,7 @@ class Item_sum :public Item_func_or_sum
int8 max_arg_level; /* max level of unbound column references */ int8 max_arg_level; /* max level of unbound column references */
int8 max_sum_func_level;/* max level of aggregation for embedded functions */ int8 max_sum_func_level;/* max level of aggregation for embedded functions */
bool quick_group; /* If incremental update of fields */ bool quick_group; /* If incremental update of fields */
bool has_error;
/* /*
This list is used by the check for mixing non aggregated fields and This list is used by the check for mixing non aggregated fields and
sum functions in the ONLY_FULL_GROUP_BY_MODE. We save all outer fields sum functions in the ONLY_FULL_GROUP_BY_MODE. We save all outer fields
...@@ -388,19 +389,19 @@ class Item_sum :public Item_func_or_sum ...@@ -388,19 +389,19 @@ class Item_sum :public Item_func_or_sum
public: public:
void mark_as_sum_func(); void mark_as_sum_func();
Item_sum(THD *thd): Item_func_or_sum(thd), quick_group(1) Item_sum(THD *thd): Item_func_or_sum(thd), quick_group(1), has_error(0)
{ {
mark_as_sum_func(); mark_as_sum_func();
init_aggregator(); init_aggregator();
} }
Item_sum(THD *thd, Item *a): Item_func_or_sum(thd, a), quick_group(1), Item_sum(THD *thd, Item *a): Item_func_or_sum(thd, a), quick_group(1),
orig_args(tmp_orig_args) has_error(0), orig_args(tmp_orig_args)
{ {
mark_as_sum_func(); mark_as_sum_func();
init_aggregator(); init_aggregator();
} }
Item_sum(THD *thd, Item *a, Item *b): Item_func_or_sum(thd, a, b), Item_sum(THD *thd, Item *a, Item *b): Item_func_or_sum(thd, a, b),
quick_group(1), orig_args(tmp_orig_args) quick_group(1), has_error(0), orig_args(tmp_orig_args)
{ {
mark_as_sum_func(); mark_as_sum_func();
init_aggregator(); init_aggregator();
......
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