From 6d179ad134882145fc56f455d6fb9770c77cb46b Mon Sep 17 00:00:00 2001 From: Sergei Petrunia Date: Tue, 4 Oct 2022 11:32:33 +0300 Subject: [PATCH] Fix typecast warnings-as-errors on Windows. --- mysql-test/main/opt_trace.result | 4 ++-- sql/opt_subselect.cc | 8 ++++++-- sql/sql_select.cc | 5 +++-- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/mysql-test/main/opt_trace.result b/mysql-test/main/opt_trace.result index 19a1f607810..ea8d6139920 100644 --- a/mysql-test/main/opt_trace.result +++ b/mysql-test/main/opt_trace.result @@ -2471,9 +2471,9 @@ explain select * from t1 where a=1 and b=2 order by c limit 1 { "index": "a_c", "can_resolve_order": true, "direction": 1, - "rows_to_examine": 4, + "rows_to_examine": 4.390243902, "range_scan": true, - "scan_cost": 10.5218905, + "scan_cost": 11.5484164, "chosen": true }, { diff --git a/sql/opt_subselect.cc b/sql/opt_subselect.cc index 263bc7dfcac..eed85efbb6d 100644 --- a/sql/opt_subselect.cc +++ b/sql/opt_subselect.cc @@ -2555,8 +2555,12 @@ bool optimize_semijoin_nests(JOIN *join, table_map all_table_map) int tableno; double rows= 1.0; while ((tableno = tm_it.next_bit()) != Table_map_iterator::BITMAP_END) - rows= COST_MULT(rows, - join->map2table[tableno]->table->opt_range_condition_rows); + { + ha_rows tbl_rows=join->map2table[tableno]-> + table->opt_range_condition_rows; + + rows= COST_MULT(rows, rows2double(tbl_rows)); + } sjm->rows= MY_MIN(sjm->rows, rows); } memcpy((uchar*) sjm->positions, diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 3bd4bd1fd1c..1dffb98075c 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -30033,11 +30033,12 @@ void JOIN::cache_const_exprs() static bool get_range_limit_read_cost(const POSITION *pos, const TABLE *table, uint keynr, - ha_rows rows_limit, + ha_rows rows_limit_arg, ha_rows rows_to_scan, double *read_cost, double *read_rows) { + double rows_limit= rows2double(rows_limit_arg); if (table->opt_range_keys.is_set(keynr)) { /* @@ -30108,7 +30109,7 @@ static bool get_range_limit_read_cost(const POSITION *pos, HA_ROWS_MAX); *read_cost= (cost.read_cost + rows_to_scan * WHERE_COST_THD(table->in_use)); - *read_rows= rows_to_scan; + *read_rows= rows2double(rows_to_scan); return 0; }