summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorRuihang Xia <waynestxia@gmail.com>2019-08-30 14:47:12 +0800
committerIgor Babaev <igor@askmonty.org>2019-08-31 18:58:01 -0700
commit2707af2dec65ffd4195b9d79a233b1f298fe1756 (patch)
tree9efbabba52a5695c4ac6ed526469e93dc0531660 /sql
parent95f35bb75d8c3a518ee90ec82eb4e237c3b4e508 (diff)
downloadmariadb-git-2707af2dec65ffd4195b9d79a233b1f298fe1756.tar.gz
(1)mod: counter type from longlong to ha_rows
(2)fix: bug when call create tmp table
Diffstat (limited to 'sql')
-rw-r--r--sql/sql_class.h2
-rw-r--r--sql/sql_union.cc21
2 files changed, 9 insertions, 14 deletions
diff --git a/sql/sql_class.h b/sql/sql_class.h
index 48207847fe1..54d6541efbf 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -5870,7 +5870,7 @@ public:
};
int send_data(List<Item> &items);
void change_select();
- int unfold_record(longlong cnt);
+ int unfold_record(ha_rows cnt);
bool send_eof();
bool force_enable_index_if_needed()
{
diff --git a/sql/sql_union.cc b/sql/sql_union.cc
index 862b7292e4a..1abc81bcdff 100644
--- a/sql/sql_union.cc
+++ b/sql/sql_union.cc
@@ -330,11 +330,6 @@ select_unit::create_result_table(THD *thd_arg, List<Item> *column_types,
tmp_table_param.bit_fields_as_long= bit_fields_as_long;
tmp_table_param.hidden_field_count= hidden;
- /*
- At least one of `duplicate_cnt` and `intersect_cnt` are used.
- in this case table can keep unique actually.
- */
- if (hidden > 0) is_union_distinct= true;
if (! (table= create_tmp_table(thd_arg, &tmp_table_param, *column_types,
(ORDER*) 0, is_union_distinct, 1,
options, HA_POS_ERROR, alias,
@@ -499,7 +494,7 @@ bool select_unit_ext::disable_index_if_needed(SELECT_LEX *curr_sl)
-1 conversion happened
*/
-int select_unit_ext::unfold_record(longlong cnt)
+int select_unit_ext::unfold_record(ha_rows cnt)
{
DBUG_ASSERT(cnt > 0);
@@ -840,7 +835,7 @@ bool select_unit_ext::send_eof()
else if (need_unfold)
{
/* unfold if is ALL operation */
- longlong dup_cnt;
+ ha_rows dup_cnt;
if (unlikely(table->file->ha_rnd_init_with_error(1)))
return 1;
do
@@ -854,7 +849,7 @@ bool select_unit_ext::send_eof()
}
break;
}
- dup_cnt= duplicate_cnt->val_int();
+ dup_cnt= (ha_rows)duplicate_cnt->val_int();
/* delete record if not exist in the second operand */
if (dup_cnt == 0)
{
@@ -865,7 +860,7 @@ bool select_unit_ext::send_eof()
{
longlong add_cnt= additional_cnt->val_int();
if (dup_cnt > add_cnt && add_cnt > 0)
- dup_cnt= add_cnt;
+ dup_cnt= (ha_rows)add_cnt;
}
if (dup_cnt == 1)
@@ -1576,9 +1571,7 @@ bool st_select_lex_unit::prepare(TABLE_LIST *derived_arg,
if (join_union_item_types(thd, types, union_part_count + 1))
goto err;
if (union_result->create_result_table(thd, &types,
- MY_TEST(union_distinct) ||
- have_except_all_or_intersect_all ||
- have_intersect,
+ MY_TEST(union_distinct),
create_options,
&derived_arg->alias, false,
instantiate_tmp_table, false,
@@ -1698,7 +1691,9 @@ cont:
}
bool error=
union_result->create_result_table(thd, &types,
- MY_TEST(union_distinct),
+ MY_TEST(union_distinct) ||
+ have_except_all_or_intersect_all ||
+ have_intersect,
create_options, &empty_clex_str, false,
instantiate_tmp_table, false,
hidden);