diff options
author | Varun Gupta <varun.gupta@mariadb.com> | 2019-04-25 18:18:26 +0530 |
---|---|---|
committer | Varun Gupta <varun.gupta@mariadb.com> | 2019-04-27 14:27:02 +0530 |
commit | 0d5aabd632ea3fc70d4de2ad934ad314231fb7c8 (patch) | |
tree | 93055f71d398ebc297ccda379e5094d931f959ec /sql | |
parent | f239fd5034fe66a06a7a254fe1721eae781b118e (diff) | |
download | mariadb-git-0d5aabd632ea3fc70d4de2ad934ad314231fb7c8.tar.gz |
MDEV-19334: bool is_eits_usable(Field*): Assertion `field->table->stats_is_read' failed.
Fixed the assert by making sure that not to use EITS if the column statistics was not allocated.
Diffstat (limited to 'sql')
-rw-r--r-- | sql/sql_statistics.cc | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/sql/sql_statistics.cc b/sql/sql_statistics.cc index b435971a4d6..061622a2cd6 100644 --- a/sql/sql_statistics.cc +++ b/sql/sql_statistics.cc @@ -4067,6 +4067,14 @@ bool is_stat_table(const char *db, const char *table) bool is_eits_usable(Field *field) { + Column_statistics* col_stats= field->read_stats; + + // check if column_statistics was allocated for this field + if (!col_stats) + return false; + + DBUG_ASSERT(field->table->stats_is_read); + /* (1): checks if we have EITS statistics for a particular column (2): Don't use EITS for GEOMETRY columns @@ -4074,10 +4082,9 @@ bool is_eits_usable(Field *field) partition list of a table. We assume the selecticivity for such columns would be handled during partition pruning. */ - DBUG_ASSERT(field->table->stats_is_read); - Column_statistics* col_stats= field->read_stats; - return col_stats && !col_stats->no_stat_values_provided() && //(1) - field->type() != MYSQL_TYPE_GEOMETRY && //(2) + + return !col_stats->no_stat_values_provided() && //(1) + field->type() != MYSQL_TYPE_GEOMETRY && //(2) #ifdef WITH_PARTITION_STORAGE_ENGINE (!field->table->part_info || !field->table->part_info->field_in_partition_expr(field)) && //(3) |