1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

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.
This commit is contained in:
Vicențiu Ciorbaru
2017-08-29 18:27:16 +03:00
committed by Varun Gupta
parent f4ba298abd
commit 24e219b179
4 changed files with 8 additions and 18 deletions

View File

@ -441,7 +441,6 @@ 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;
} }
@ -453,7 +452,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), has_error(FALSE), quick_group(item->quick_group),
orig_args(NULL) orig_args(NULL)
{ {
if (arg_count <= 2) if (arg_count <= 2)

View File

@ -367,7 +367,6 @@ public:
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
@ -389,19 +388,19 @@ protected:
public: public:
void mark_as_sum_func(); 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(); 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),
has_error(0), orig_args(tmp_orig_args) 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), has_error(0), orig_args(tmp_orig_args) quick_group(1), orig_args(tmp_orig_args)
{ {
mark_as_sum_func(); mark_as_sum_func();
init_aggregator(); init_aggregator();

View File

@ -767,7 +767,6 @@ public:
if (prev_value >1 || prev_value < 0) if (prev_value >1 || prev_value < 0)
{ {
my_error(ER_ARGUMENT_OUT_OF_RANGE, MYF(0)); my_error(ER_ARGUMENT_OUT_OF_RANGE, MYF(0));
has_error= TRUE;
return true; return true;
} }
first_call= false; first_call= false;
@ -778,7 +777,6 @@ public:
if (prev_value != arg_val) if (prev_value != arg_val)
{ {
my_error(ER_ARGUMENT_NOT_CONSTANT, MYF(0)); my_error(ER_ARGUMENT_NOT_CONSTANT, MYF(0));
has_error= TRUE;
return true; return true;
} }
@ -805,7 +803,6 @@ public:
void clear() void clear()
{ {
has_error= false;
val_calculated= false; val_calculated= false;
first_call= true; first_call= true;
value->clear(); value->clear();
@ -890,7 +887,6 @@ public:
if (prev_value >1 || prev_value < 0) if (prev_value >1 || prev_value < 0)
{ {
my_error(ER_ARGUMENT_OUT_OF_RANGE, MYF(0)); my_error(ER_ARGUMENT_OUT_OF_RANGE, MYF(0));
has_error= TRUE;
return true; return true;
} }
} }
@ -899,7 +895,6 @@ public:
if (prev_value != arg_val) if (prev_value != arg_val)
{ {
my_error(ER_ARGUMENT_NOT_CONSTANT, MYF(0)); my_error(ER_ARGUMENT_NOT_CONSTANT, MYF(0));
has_error= TRUE;
return true; return true;
} }
@ -937,7 +932,6 @@ public:
void clear() void clear()
{ {
first_call= true; first_call= true;
has_error= false;
floor_value->clear(); floor_value->clear();
ceil_value->clear(); ceil_value->clear();
floor_val_calculated= false; floor_val_calculated= false;

View File

@ -1080,8 +1080,6 @@ protected:
while ((item_sum= it++)) while ((item_sum= it++))
{ {
item_sum->add(); 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(); 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 /* Return to current row after notifying cursors for each window
function. */ function. */
@ -2824,7 +2823,6 @@ bool compute_window_func(THD *thd,
rownum++; rownum++;
} }
label:
my_free(rowid_buf); my_free(rowid_buf);
partition_trackers.delete_elements(); partition_trackers.delete_elements();
end_read_record(&info); end_read_record(&info);