Skip to content

Commit 3305779

Browse files
committed
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
1 parent 64a2a30 commit 3305779

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

sql/item_sum.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -441,6 +441,7 @@ Item_sum::Item_sum(THD *thd, List<Item> &list): Item_func_or_sum(thd, list)
441441
mark_as_sum_func();
442442
init_aggregator();
443443
list.empty(); // Fields are used
444+
has_error= FALSE;
444445
}
445446

446447

@@ -452,7 +453,7 @@ Item_sum::Item_sum(THD *thd, Item_sum *item):
452453
Item_func_or_sum(thd, item),
453454
aggr_sel(item->aggr_sel),
454455
nest_level(item->nest_level), aggr_level(item->aggr_level),
455-
quick_group(item->quick_group),
456+
quick_group(item->quick_group), has_error(FALSE),
456457
orig_args(NULL)
457458
{
458459
if (arg_count <= 2)

sql/item_sum.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,7 @@ class Item_sum :public Item_func_or_sum
367367
int8 max_arg_level; /* max level of unbound column references */
368368
int8 max_sum_func_level;/* max level of aggregation for embedded functions */
369369
bool quick_group; /* If incremental update of fields */
370+
bool has_error;
370371
/*
371372
This list is used by the check for mixing non aggregated fields and
372373
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
388389
public:
389390

390391
void mark_as_sum_func();
391-
Item_sum(THD *thd): Item_func_or_sum(thd), quick_group(1)
392+
Item_sum(THD *thd): Item_func_or_sum(thd), quick_group(1), has_error(0)
392393
{
393394
mark_as_sum_func();
394395
init_aggregator();
395396
}
396397
Item_sum(THD *thd, Item *a): Item_func_or_sum(thd, a), quick_group(1),
397-
orig_args(tmp_orig_args)
398+
has_error(0), orig_args(tmp_orig_args)
398399
{
399400
mark_as_sum_func();
400401
init_aggregator();
401402
}
402403
Item_sum(THD *thd, Item *a, Item *b): Item_func_or_sum(thd, a, b),
403-
quick_group(1), orig_args(tmp_orig_args)
404+
quick_group(1), has_error(0), orig_args(tmp_orig_args)
404405
{
405406
mark_as_sum_func();
406407
init_aggregator();

0 commit comments

Comments
 (0)