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.
This commit is contained in:
parent
3dc6f0410b
commit
47f15ea73c
@ -324,7 +324,7 @@ private:
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
inline void init(THD *thd, Field * table_field);
|
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 finish(ha_rows rows);
|
||||||
inline void cleanup();
|
inline void cleanup();
|
||||||
};
|
};
|
||||||
@ -2483,7 +2483,7 @@ void Column_statistics_collected::init(THD *thd, Field *table_field)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
inline
|
inline
|
||||||
bool Column_statistics_collected::add(ha_rows rowno)
|
bool Column_statistics_collected::add()
|
||||||
{
|
{
|
||||||
|
|
||||||
bool err= 0;
|
bool err= 0;
|
||||||
@ -2492,9 +2492,11 @@ bool Column_statistics_collected::add(ha_rows rowno)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
column_total_length+= column->value_length();
|
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);
|
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);
|
set_not_null(COLUMN_STAT_MAX_VALUE);
|
||||||
if (count_distinct)
|
if (count_distinct)
|
||||||
err= count_distinct->add();
|
err= count_distinct->add();
|
||||||
@ -2761,7 +2763,7 @@ int collect_statistics_for_table(THD *thd, TABLE *table)
|
|||||||
table_field= *field_ptr;
|
table_field= *field_ptr;
|
||||||
if (!bitmap_is_set(table->read_set, table_field->field_index))
|
if (!bitmap_is_set(table->read_set, table_field->field_index))
|
||||||
continue;
|
continue;
|
||||||
if ((rc= table_field->collected_stats->add(rows)))
|
if ((rc= table_field->collected_stats->add()))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (rc)
|
if (rc)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user