Commit 24e219b1 authored by Vicențiu Ciorbaru's avatar Vicențiu Ciorbaru Committed by Varun Gupta

Remove has_error as a member from Item_sum and use THD::is_error() instead

Additionally, allow a query with window functions to be killed by the user during
its execution.
parent f4ba298a
......@@ -441,7 +441,6 @@ Item_sum::Item_sum(THD *thd, List<Item> &list): Item_func_or_sum(thd, list)
mark_as_sum_func();
init_aggregator();
list.empty(); // Fields are used
has_error= FALSE;
}
......@@ -453,7 +452,7 @@ Item_sum::Item_sum(THD *thd, Item_sum *item):
Item_func_or_sum(thd, item),
aggr_sel(item->aggr_sel),
nest_level(item->nest_level), aggr_level(item->aggr_level),
quick_group(item->quick_group), has_error(FALSE),
quick_group(item->quick_group),
orig_args(NULL)
{
if (arg_count <= 2)
......
......@@ -367,7 +367,6 @@ class Item_sum :public Item_func_or_sum
int8 max_arg_level; /* max level of unbound column references */
int8 max_sum_func_level;/* max level of aggregation for embedded functions */
bool quick_group; /* If incremental update of fields */
bool has_error;
/*
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
......@@ -389,19 +388,19 @@ class Item_sum :public Item_func_or_sum
public:
void mark_as_sum_func();
Item_sum(THD *thd): Item_func_or_sum(thd), quick_group(1), has_error(0)
Item_sum(THD *thd): Item_func_or_sum(thd), quick_group(1)
{
mark_as_sum_func();
init_aggregator();
}
Item_sum(THD *thd, Item *a): Item_func_or_sum(thd, a), quick_group(1),
has_error(0), orig_args(tmp_orig_args)
orig_args(tmp_orig_args)
{
mark_as_sum_func();
init_aggregator();
}
Item_sum(THD *thd, Item *a, Item *b): Item_func_or_sum(thd, a, b),
quick_group(1), has_error(0), orig_args(tmp_orig_args)
quick_group(1), orig_args(tmp_orig_args)
{
mark_as_sum_func();
init_aggregator();
......
......@@ -767,7 +767,6 @@ class Item_sum_percentile_disc : public Item_sum_cume_dist,
if (prev_value >1 || prev_value < 0)
{
my_error(ER_ARGUMENT_OUT_OF_RANGE, MYF(0));
has_error= TRUE;
return true;
}
first_call= false;
......@@ -778,7 +777,6 @@ class Item_sum_percentile_disc : public Item_sum_cume_dist,
if (prev_value != arg_val)
{
my_error(ER_ARGUMENT_NOT_CONSTANT, MYF(0));
has_error= TRUE;
return true;
}
......@@ -805,7 +803,6 @@ class Item_sum_percentile_disc : public Item_sum_cume_dist,
void clear()
{
has_error= false;
val_calculated= false;
first_call= true;
value->clear();
......@@ -890,7 +887,6 @@ class Item_sum_percentile_cont : public Item_sum_cume_dist,
if (prev_value >1 || prev_value < 0)
{
my_error(ER_ARGUMENT_OUT_OF_RANGE, MYF(0));
has_error= TRUE;
return true;
}
}
......@@ -899,7 +895,6 @@ class Item_sum_percentile_cont : public Item_sum_cume_dist,
if (prev_value != arg_val)
{
my_error(ER_ARGUMENT_NOT_CONSTANT, MYF(0));
has_error= TRUE;
return true;
}
......@@ -937,7 +932,6 @@ class Item_sum_percentile_cont : public Item_sum_cume_dist,
void clear()
{
first_call= true;
has_error= false;
floor_value->clear();
ceil_value->clear();
floor_val_calculated= false;
......
......@@ -1080,8 +1080,6 @@ class Frame_cursor : public Sql_alloc
while ((item_sum= it++))
{
item_sum->add();
if (item_sum->has_error)
return;
}
}
......@@ -2807,10 +2805,11 @@ bool compute_window_func(THD *thd,
cursor_manager->notify_cursors_next_row();
}
/* check if we found any error in the window function while calling the add function */
/* Check if we found any error in the window function while adding values
through cursors. */
if (thd->is_error() || thd->is_killed())
break;
if (win_func->window_func()->has_error)
goto label;
/* Return to current row after notifying cursors for each window
function. */
......@@ -2824,7 +2823,6 @@ bool compute_window_func(THD *thd,
rownum++;
}
label:
my_free(rowid_buf);
partition_trackers.delete_elements();
end_read_record(&info);
......
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