diff options
author | Vicențiu Ciorbaru <vicentiu@mariadb.org> | 2017-08-29 18:27:16 +0300 |
---|---|---|
committer | Varun Gupta <varunraiko1803@gmail.com> | 2017-11-01 23:13:02 +0530 |
commit | 24e219b179142b3708ff4bdf5ae3db96d6fa184a (patch) | |
tree | dede0c065c0229dd765a8afd5a7ee22bb0f662c4 /sql | |
parent | f4ba298abd06024f619659a4d9aae1e3fad97b08 (diff) | |
download | mariadb-git-24e219b179142b3708ff4bdf5ae3db96d6fa184a.tar.gz |
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.
Diffstat (limited to 'sql')
-rw-r--r-- | sql/item_sum.cc | 3 | ||||
-rw-r--r-- | sql/item_sum.h | 7 | ||||
-rw-r--r-- | sql/item_windowfunc.h | 6 | ||||
-rw-r--r-- | sql/sql_window.cc | 10 |
4 files changed, 8 insertions, 18 deletions
diff --git a/sql/item_sum.cc b/sql/item_sum.cc index 4f9cdfe20e8..b047dc4ea4d 100644 --- a/sql/item_sum.cc +++ b/sql/item_sum.cc @@ -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) diff --git a/sql/item_sum.h b/sql/item_sum.h index a3bcf397db7..467a77c8983 100644 --- a/sql/item_sum.h +++ b/sql/item_sum.h @@ -367,7 +367,6 @@ public: 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 @@ protected: 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(); diff --git a/sql/item_windowfunc.h b/sql/item_windowfunc.h index a2357b24980..c1a8c594e20 100644 --- a/sql/item_windowfunc.h +++ b/sql/item_windowfunc.h @@ -767,7 +767,6 @@ public: 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 @@ public: if (prev_value != arg_val) { my_error(ER_ARGUMENT_NOT_CONSTANT, MYF(0)); - has_error= TRUE; return true; } @@ -805,7 +803,6 @@ public: void clear() { - has_error= false; val_calculated= false; first_call= true; value->clear(); @@ -890,7 +887,6 @@ public: 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 @@ public: if (prev_value != arg_val) { my_error(ER_ARGUMENT_NOT_CONSTANT, MYF(0)); - has_error= TRUE; return true; } @@ -937,7 +932,6 @@ public: void clear() { first_call= true; - has_error= false; floor_value->clear(); ceil_value->clear(); floor_val_calculated= false; diff --git a/sql/sql_window.cc b/sql/sql_window.cc index e60e23c80cf..9a274179b21 100644 --- a/sql/sql_window.cc +++ b/sql/sql_window.cc @@ -1080,8 +1080,6 @@ protected: 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); |