diff options
author | Sergei Golubchik <serg@mariadb.org> | 2019-08-25 18:36:59 +0200 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2019-08-26 00:13:15 +0200 |
commit | 4f321289af20427d59aa7c46daa3597122a5eca2 (patch) | |
tree | abd05a119a4ceaec2feb5e170082fc7d31a6eac1 | |
parent | 9db31471641071bcc8f74a6a22b2a3845c830e3d (diff) | |
download | mariadb-git-bb-10.0-release.tar.gz |
fix EXPLAIN outputbb-10.0-release
1. avoid ha_rows->double->ha_rows cast, for ~0ULL it behaves
differently on Linux and Windows. This fixes the differences
in derived_view and mdev13607 results between Linux and Windows.
2. EXPLAIN should show the number of rows as an unsigned number.
-rw-r--r-- | mysql-test/r/derived_view.result | 18 | ||||
-rw-r--r-- | mysql-test/r/mdev13607.result | 30 | ||||
-rw-r--r-- | sql/sql_explain.cc | 2 | ||||
-rw-r--r-- | sql/sql_select.cc | 41 |
4 files changed, 41 insertions, 50 deletions
diff --git a/mysql-test/r/derived_view.result b/mysql-test/r/derived_view.result index d1c993b39bb..8ba3181507e 100644 --- a/mysql-test/r/derived_view.result +++ b/mysql-test/r/derived_view.result @@ -2954,15 +2954,15 @@ id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY p10 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) 1 PRIMARY <derived17> ALL NULL NULL NULL NULL 50328437500000 Using where; Using join buffer (incremental, BNL join) 1 PRIMARY <derived14> ALL NULL NULL NULL NULL 27680640625000000 Using where; Using join buffer (incremental, BNL join) -1 PRIMARY <derived9> ALL NULL NULL NULL NULL -3222391729959550976 Using where; Using join buffer (incremental, BNL join) -1 PRIMARY <derived10> ALL NULL NULL NULL NULL -3222391729959550976 Using where; Using join buffer (incremental, BNL join) -1 PRIMARY <derived11> ALL NULL NULL NULL NULL -3222391729959550976 Using where; Using join buffer (incremental, BNL join) -1 PRIMARY <derived12> ALL NULL NULL NULL NULL -3222391729959550976 Using where; Using join buffer (incremental, BNL join) -1 PRIMARY <derived13> ALL NULL NULL NULL NULL -3222391729959550976 Using where; Using join buffer (incremental, BNL join) -1 PRIMARY <derived15> ALL NULL NULL NULL NULL -3222391729959550976 Using where; Using join buffer (incremental, BNL join) -1 PRIMARY <derived16> ALL NULL NULL NULL NULL -3222391729959550976 Using where; Using join buffer (incremental, BNL join) -1 PRIMARY <derived7> ALL NULL NULL NULL NULL 0 Using where; Using join buffer (incremental, BNL join) -1 PRIMARY <derived8> ALL NULL NULL NULL NULL 0 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY <derived9> ALL NULL NULL NULL NULL 15224352343750000640 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY <derived10> ALL NULL NULL NULL NULL 15224352343750000640 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY <derived11> ALL NULL NULL NULL NULL 15224352343750000640 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY <derived12> ALL NULL NULL NULL NULL 15224352343750000640 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY <derived13> ALL NULL NULL NULL NULL 15224352343750000640 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY <derived15> ALL NULL NULL NULL NULL 15224352343750000640 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY <derived16> ALL NULL NULL NULL NULL 15224352343750000640 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY <derived7> ALL NULL NULL NULL NULL 18446744073709551615 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY <derived8> ALL NULL NULL NULL NULL 18446744073709551615 Using where; Using join buffer (incremental, BNL join) 17 DERIVED t2 system NULL NULL NULL NULL 1 17 DERIVED p4 ALL NULL NULL NULL NULL 550 Using where 17 DERIVED p5 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (flat, BNL join) diff --git a/mysql-test/r/mdev13607.result b/mysql-test/r/mdev13607.result index 451722ffd17..f5edfa6a8d6 100644 --- a/mysql-test/r/mdev13607.result +++ b/mysql-test/r/mdev13607.result @@ -76,21 +76,21 @@ id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY p7 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) 1 PRIMARY p8 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) 1 PRIMARY p9 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -1 PRIMARY <derived3> ALL NULL NULL NULL NULL 0 Using join buffer (incremental, BNL join) -1 PRIMARY <derived4> ALL NULL NULL NULL NULL 0 Using join buffer (incremental, BNL join) -1 PRIMARY <derived5> ALL NULL NULL NULL NULL 0 Using join buffer (incremental, BNL join) -1 PRIMARY <derived6> ALL NULL NULL NULL NULL 0 Using join buffer (incremental, BNL join) -1 PRIMARY <derived7> ALL NULL NULL NULL NULL 0 Using join buffer (incremental, BNL join) -1 PRIMARY <derived8> ALL NULL NULL NULL NULL 0 Using join buffer (incremental, BNL join) -1 PRIMARY <derived9> ALL NULL NULL NULL NULL 0 Using join buffer (incremental, BNL join) -1 PRIMARY <derived10> ALL NULL NULL NULL NULL 0 Using join buffer (incremental, BNL join) -1 PRIMARY <derived11> ALL NULL NULL NULL NULL 0 Using join buffer (incremental, BNL join) -1 PRIMARY <derived12> ALL NULL NULL NULL NULL 0 Using join buffer (incremental, BNL join) -1 PRIMARY <derived13> ALL NULL NULL NULL NULL 0 Using join buffer (incremental, BNL join) -1 PRIMARY <derived14> ALL NULL NULL NULL NULL 0 Using join buffer (incremental, BNL join) -1 PRIMARY <derived15> ALL NULL NULL NULL NULL 0 Using join buffer (incremental, BNL join) -1 PRIMARY <derived16> ALL NULL NULL NULL NULL 0 Using join buffer (incremental, BNL join) -1 PRIMARY <derived17> ALL NULL NULL NULL NULL 0 Using join buffer (incremental, BNL join) +1 PRIMARY <derived3> ALL NULL NULL NULL NULL 18446744073709551615 Using join buffer (incremental, BNL join) +1 PRIMARY <derived4> ALL NULL NULL NULL NULL 18446744073709551615 Using join buffer (incremental, BNL join) +1 PRIMARY <derived5> ALL NULL NULL NULL NULL 18446744073709551615 Using join buffer (incremental, BNL join) +1 PRIMARY <derived6> ALL NULL NULL NULL NULL 18446744073709551615 Using join buffer (incremental, BNL join) +1 PRIMARY <derived7> ALL NULL NULL NULL NULL 18446744073709551615 Using join buffer (incremental, BNL join) +1 PRIMARY <derived8> ALL NULL NULL NULL NULL 18446744073709551615 Using join buffer (incremental, BNL join) +1 PRIMARY <derived9> ALL NULL NULL NULL NULL 18446744073709551615 Using join buffer (incremental, BNL join) +1 PRIMARY <derived10> ALL NULL NULL NULL NULL 18446744073709551615 Using join buffer (incremental, BNL join) +1 PRIMARY <derived11> ALL NULL NULL NULL NULL 18446744073709551615 Using join buffer (incremental, BNL join) +1 PRIMARY <derived12> ALL NULL NULL NULL NULL 18446744073709551615 Using join buffer (incremental, BNL join) +1 PRIMARY <derived13> ALL NULL NULL NULL NULL 18446744073709551615 Using join buffer (incremental, BNL join) +1 PRIMARY <derived14> ALL NULL NULL NULL NULL 18446744073709551615 Using join buffer (incremental, BNL join) +1 PRIMARY <derived15> ALL NULL NULL NULL NULL 18446744073709551615 Using join buffer (incremental, BNL join) +1 PRIMARY <derived16> ALL NULL NULL NULL NULL 18446744073709551615 Using join buffer (incremental, BNL join) +1 PRIMARY <derived17> ALL NULL NULL NULL NULL 18446744073709551615 Using join buffer (incremental, BNL join) 17 DERIVED r1 ALL NULL NULL NULL NULL 2 17 DERIVED d1 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) 17 DERIVED r2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) diff --git a/sql/sql_explain.cc b/sql/sql_explain.cc index 75f6689ab98..0f4fd7eea82 100644 --- a/sql/sql_explain.cc +++ b/sql/sql_explain.cc @@ -508,7 +508,7 @@ int Explain_table_access::print_explain(select_result_sink *output, uint8 explai /* `rows` */ if (rows_set) { - item_list.push_back(new Item_int((longlong) (ulonglong) rows, + item_list.push_back(new Item_int((ulonglong) rows, MY_INT64_NUM_DECIMAL_DIGITS)); } else diff --git a/sql/sql_select.cc b/sql/sql_select.cc index d366e43244f..a472bcf2bde 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -11615,12 +11615,11 @@ double JOIN_TAB::scan_time() ha_rows JOIN_TAB::get_examined_rows() { - double examined_rows; - if (select && select->quick && use_quick != 2) - examined_rows= select->quick->records; - else if (type == JT_NEXT || type == JT_ALL || - type == JT_HASH || type ==JT_HASH_NEXT) + return select->quick->records; + + if (type == JT_NEXT || type == JT_ALL || + type == JT_HASH || type ==JT_HASH_NEXT) { if (limit) { @@ -11628,26 +11627,20 @@ ha_rows JOIN_TAB::get_examined_rows() @todo This estimate is wrong, a LIMIT query may examine much more rows than the LIMIT itself. */ - examined_rows= limit; - } - else - { - if (table->is_filled_at_execution()) - examined_rows= records; - else - { - /* - handler->info(HA_STATUS_VARIABLE) has been called in - make_join_statistics() - */ - examined_rows= table->stat_records(); - } + return limit; } + + if (table->is_filled_at_execution()) + return records; + + /* + handler->info(HA_STATUS_VARIABLE) has been called in + make_join_statistics() + */ + return table->stat_records(); } - else - examined_rows= records_read; - return (ha_rows) examined_rows; + return (ha_rows) records_read; } @@ -24023,10 +24016,8 @@ int JOIN::save_explain_data_intern(Explain_query *output, bool need_tmp_table, } else { - double examined_rows= tab->get_examined_rows(); - + double examined_rows= eta->rows= tab->get_examined_rows(); eta->rows_set= true; - eta->rows= (ha_rows) examined_rows; /* "filtered" */ float f= 0.0; |