mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Use existing statistics test to improve coverage for JSON statistics
Signed-off-by: Michael Okoko <okokomichaels@outlook.com>
This commit is contained in:
committed by
Sergei Petrunia
parent
3692adebd4
commit
058a90e6f5
@ -1,3 +1,13 @@
|
||||
set @SINGLE_PREC_TYPE='single_prec_hb';
|
||||
set @DOUBLE_PREC_TYPE='double_prec_hb';
|
||||
set @DEFAULT_HIST_TYPE=@@histogram_type;
|
||||
|
||||
if ($histogram_type_override) {
|
||||
eval set @SINGLE_PREC_TYPE=$histogram_type_override;
|
||||
eval set @DOUBLE_PREC_TYPE=$histogram_type_override;
|
||||
eval set @DEFAULT_HIST_TYPE=$histogram_type_override;
|
||||
}
|
||||
|
||||
--source include/have_stat_tables.inc
|
||||
--source include/have_innodb.inc
|
||||
--disable_warnings
|
||||
@ -7,8 +17,8 @@ drop table if exists t1,t2;
|
||||
set @save_use_stat_tables=@@use_stat_tables;
|
||||
set @save_histogram_size=@@global.histogram_size;
|
||||
set @@global.histogram_size=0,@@local.histogram_size=0;
|
||||
set @save_hist_type=@@histogram_type;
|
||||
set histogram_type='single_prec_hb';
|
||||
set @save_hist_type=@DEFAULT_HIST_TYPE;
|
||||
set histogram_type=@SINGLE_PREC_TYPE;
|
||||
|
||||
DELETE FROM mysql.table_stats;
|
||||
--sorted_result
|
||||
@ -187,7 +197,7 @@ SELECT db_name, table_name, column_name,
|
||||
DELETE FROM mysql.column_stats;
|
||||
|
||||
set histogram_size=8;
|
||||
set histogram_type='DOUBLE_PREC_HB';
|
||||
set histogram_type=@DOUBLE_PREC_TYPE;
|
||||
ANALYZE TABLE t1;
|
||||
|
||||
--sorted_result
|
||||
@ -200,7 +210,7 @@ SELECT db_name, table_name, column_name,
|
||||
DELETE FROM mysql.column_stats;
|
||||
|
||||
set histogram_size= 0;
|
||||
set histogram_type='single_prec_hb';
|
||||
set histogram_type=@SINGLE_PREC_TYPE;
|
||||
ANALYZE TABLE t1;
|
||||
|
||||
|
||||
@ -650,10 +660,10 @@ use world;
|
||||
set use_stat_tables='preferably';
|
||||
--disable_result_log
|
||||
set histogram_size=100;
|
||||
set histogram_type='SINGLE_PREC_HB';
|
||||
set histogram_type=@SINGLE_PREC_TYPE;
|
||||
ANALYZE TABLE CountryLanguage;
|
||||
set histogram_size=254;
|
||||
set histogram_type='DOUBLE_PREC_HB';
|
||||
set histogram_type=@DOUBLE_PREC_TYPE;
|
||||
ANALYZE TABLE City;
|
||||
FLUSH TABLES;
|
||||
--enable_result_log
|
||||
@ -661,7 +671,7 @@ FLUSH TABLES;
|
||||
--query_vertical select UPPER(db_name),UPPER(table_name),UPPER(column_name),min_value,max_value,nulls_ratio,avg_length,avg_frequency,hist_size,hist_type,hex(histogram),decode_histogram(hist_type,histogram) from mysql.column_stats where UPPER(db_name)='WORLD' and UPPER(table_name)='COUNTRYLANGUAGE' and UPPER(column_name) = 'PERCENTAGE';
|
||||
--query_vertical select UPPER(db_name),UPPER(table_name),UPPER(column_name),min_value,max_value,nulls_ratio,avg_length,avg_frequency,hist_size,hist_type,hex(histogram),decode_histogram(hist_type,histogram) from mysql.column_stats where UPPER(db_name)='WORLD' and UPPER(table_name)='CITY' and UPPER(column_name) = 'POPULATION';
|
||||
|
||||
set histogram_type='single_prec_hb';
|
||||
set histogram_type=@SINGLE_PREC_TYPE;
|
||||
set histogram_size=0;
|
||||
|
||||
use test;
|
||||
@ -724,7 +734,7 @@ create table t1 ( a int);
|
||||
insert into t1 values (1),(2),(3),(4),(5);
|
||||
|
||||
set histogram_size=10;
|
||||
set histogram_type='double_prec_hb';
|
||||
set histogram_type=@DOUBLE_PREC_TYPE;
|
||||
|
||||
show variables like 'histogram%';
|
||||
|
||||
@ -737,7 +747,7 @@ select db_name, table_name, column_name,
|
||||
FROM mysql.column_stats;
|
||||
|
||||
set histogram_size=0;
|
||||
set histogram_type='single_prec_hb';
|
||||
set histogram_type=@SINGLE_PREC_TYPE;
|
||||
|
||||
drop table t1;
|
||||
|
||||
@ -908,11 +918,14 @@ set use_stat_tables=@save_use_stat_tables;
|
||||
--echo # MDEV-10134 Add full support for DEFAULT
|
||||
--echo #
|
||||
|
||||
CREATE TABLE t1 (a BLOB, b TEXT DEFAULT DECODE_HISTOGRAM('SINGLE_PREC_HB',a));
|
||||
# disable for JSON histograms
|
||||
if (!$histogram_type_override) {
|
||||
CREATE TABLE t1 (a BLOB, b TEXT DEFAULT DECODE_HISTOGRAM(@SINGLE_PREC_TYPE,a));
|
||||
SHOW CREATE TABLE t1;
|
||||
INSERT INTO t1 (a) VALUES (0x0000000000000000000000000101010101010101010202020303030304040404050505050606070707080809090A0A0B0C0D0D0E0E0F10111213131415161718191B1C1E202224292A2E33373B4850575F6A76818C9AA7B9C4CFDADFE5EBF0F4F8FAFCFF);
|
||||
SELECT b FROM t1;
|
||||
DROP TABLE t1;
|
||||
}
|
||||
|
||||
--echo #
|
||||
--echo # End of 10.2 tests
|
||||
|
Reference in New Issue
Block a user