diff options
author | Vicențiu Ciorbaru <vicentiu@mariadb.org> | 2019-02-14 23:03:53 +0200 |
---|---|---|
committer | Vicențiu Ciorbaru <vicentiu@mariadb.org> | 2019-02-19 12:01:21 +0200 |
commit | 47f15ea73c49e90b16a4a4adf5414f51bdbf97a4 (patch) | |
tree | 2625979f7170ad734d9d83a927464c9625eed2a6 | |
parent | 3dc6f0410baf2caa81394c3b0f8963807f77fc78 (diff) | |
download | mariadb-git-47f15ea73c49e90b16a4a4adf5414f51bdbf97a4.tar.gz |
Simplify column data adding method
The add method does not need to provide the row order number. It was
only used to detect if the minimum/maximum value was populated once or not, so
as to force an update for the first encounter of a value.
-rw-r--r-- | sql/sql_statistics.cc | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/sql/sql_statistics.cc b/sql/sql_statistics.cc index db214a1fe28..f903ce143a4 100644 --- a/sql/sql_statistics.cc +++ b/sql/sql_statistics.cc @@ -324,7 +324,7 @@ private: public: inline void init(THD *thd, Field * table_field); - inline bool add(ha_rows rowno); + inline bool add(); inline void finish(ha_rows rows); inline void cleanup(); }; @@ -2483,7 +2483,7 @@ void Column_statistics_collected::init(THD *thd, Field *table_field) */ inline -bool Column_statistics_collected::add(ha_rows rowno) +bool Column_statistics_collected::add() { bool err= 0; @@ -2492,9 +2492,11 @@ bool Column_statistics_collected::add(ha_rows rowno) else { column_total_length+= column->value_length(); - if (min_value && column->update_min(min_value, rowno == nulls)) + if (min_value && column->update_min(min_value, + is_null(COLUMN_STAT_MIN_VALUE))) set_not_null(COLUMN_STAT_MIN_VALUE); - if (max_value && column->update_max(max_value, rowno == nulls)) + if (max_value && column->update_max(max_value, + is_null(COLUMN_STAT_MAX_VALUE))) set_not_null(COLUMN_STAT_MAX_VALUE); if (count_distinct) err= count_distinct->add(); @@ -2761,7 +2763,7 @@ int collect_statistics_for_table(THD *thd, TABLE *table) table_field= *field_ptr; if (!bitmap_is_set(table->read_set, table_field->field_index)) continue; - if ((rc= table_field->collected_stats->add(rows))) + if ((rc= table_field->collected_stats->add())) break; } if (rc) |