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,9 +1,11 @@
|
||||
set @SINGLE_PREC_TYPE='single_prec_hb';
|
||||
set @DOUBLE_PREC_TYPE='double_prec_hb';
|
||||
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 histogram_type=@SINGLE_PREC_TYPE;
|
||||
DELETE FROM mysql.table_stats;
|
||||
DELETE FROM mysql.column_stats;
|
||||
DELETE FROM mysql.index_stats;
|
||||
@ -231,7 +233,7 @@ test t1 e 0.01 0.112 0.2250 6.2000 4 SINGLE_PREC_HB 000564E1
|
||||
test t1 f 1 5 0.2000 6.4000 4 SINGLE_PREC_HB 3F7FBFBF
|
||||
DELETE FROM mysql.column_stats;
|
||||
set histogram_size=8;
|
||||
set histogram_type='DOUBLE_PREC_HB';
|
||||
set histogram_type=@DOUBLE_PREC_TYPE;
|
||||
ANALYZE TABLE t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 analyze status Engine-independent statistics collected
|
||||
@ -250,7 +252,7 @@ test t1 e 0.01 0.112 0.2250 6.2000 8 DOUBLE_PREC_HB 000005056464E1E1
|
||||
test t1 f 1 5 0.2000 6.4000 8 DOUBLE_PREC_HB FF3FFF7FFFBFFFBF
|
||||
DELETE FROM mysql.column_stats;
|
||||
set histogram_size= 0;
|
||||
set histogram_type='single_prec_hb';
|
||||
set histogram_type=@SINGLE_PREC_TYPE;
|
||||
ANALYZE TABLE t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 analyze status Engine-independent statistics collected
|
||||
@ -1476,10 +1478,10 @@ WORLD_INNODB COUNTRYLANGUAGE Percentage 1 2.7640
|
||||
use world;
|
||||
set use_stat_tables='preferably';
|
||||
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;
|
||||
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';;
|
||||
@ -1508,7 +1510,7 @@ hist_size 254
|
||||
hist_type DOUBLE_PREC_HB
|
||||
hex(histogram) 1F00A1002B023002350238023F02430249024E02520258025D02630268026E02720276027B02800285028C02920297029D02A102A802AC02B402BC02C402CC02D302DA02E302EA02F102F802010305030C03120319031F03290333033D0343034F03590363036D037803840390039A03A603B303C303D103E003F203020412042404330440045304600472047F049104A204B804C804DE04F2040A0526053F0558056F058E05B305D905F4051306380667068406AB06DA06020731075C079407C507F8072E085E08A508DF0824096909CC092E0A760AD50A400BA90B150CAD0C310D240E130F0E103B11B9126B14F0166B192F1CB71FFF240630483FC567
|
||||
decode_histogram(hist_type,histogram) 0.00047,0.00198,0.00601,0.00008,0.00008,0.00005,0.00011,0.00006,0.00009,0.00008,0.00006,0.00009,0.00008,0.00009,0.00008,0.00009,0.00006,0.00006,0.00008,0.00008,0.00008,0.00011,0.00009,0.00008,0.00009,0.00006,0.00011,0.00006,0.00012,0.00012,0.00012,0.00012,0.00011,0.00011,0.00014,0.00011,0.00011,0.00011,0.00014,0.00006,0.00011,0.00009,0.00011,0.00009,0.00015,0.00015,0.00015,0.00009,0.00018,0.00015,0.00015,0.00015,0.00017,0.00018,0.00018,0.00015,0.00018,0.00020,0.00024,0.00021,0.00023,0.00027,0.00024,0.00024,0.00027,0.00023,0.00020,0.00029,0.00020,0.00027,0.00020,0.00027,0.00026,0.00034,0.00024,0.00034,0.00031,0.00037,0.00043,0.00038,0.00038,0.00035,0.00047,0.00056,0.00058,0.00041,0.00047,0.00056,0.00072,0.00044,0.00060,0.00072,0.00061,0.00072,0.00066,0.00085,0.00075,0.00078,0.00082,0.00073,0.00108,0.00089,0.00105,0.00105,0.00151,0.00150,0.00110,0.00145,0.00163,0.00160,0.00165,0.00232,0.00201,0.00371,0.00365,0.00383,0.00459,0.00583,0.00662,0.00984,0.00969,0.01080,0.01379,0.02063,0.04308,0.05960,0.15816,0.59464
|
||||
set histogram_type='single_prec_hb';
|
||||
set histogram_type=@SINGLE_PREC_TYPE;
|
||||
set histogram_size=0;
|
||||
use test;
|
||||
DROP DATABASE world;
|
||||
@ -1588,7 +1590,7 @@ drop table t1;
|
||||
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%';
|
||||
Variable_name Value
|
||||
histogram_size 10
|
||||
@ -1605,7 +1607,7 @@ FROM mysql.column_stats;
|
||||
db_name table_name column_name min_value max_value nulls_ratio avg_frequency hist_size hist_type HEX(histogram)
|
||||
test t1 a 1 5 0.0000 1.0000 10 DOUBLE_PREC_HB 0000FF3FFF7FFFBFFFFF
|
||||
set histogram_size=0;
|
||||
set histogram_type='single_prec_hb';
|
||||
set histogram_type=@SINGLE_PREC_TYPE;
|
||||
drop table t1;
|
||||
#
|
||||
# Bug mdev-4369: histogram for a column with many distinct values
|
||||
@ -1760,12 +1762,12 @@ set use_stat_tables=@save_use_stat_tables;
|
||||
#
|
||||
# MDEV-10134 Add full support for DEFAULT
|
||||
#
|
||||
CREATE TABLE t1 (a BLOB, b TEXT DEFAULT DECODE_HISTOGRAM('SINGLE_PREC_HB',a));
|
||||
CREATE TABLE t1 (a BLOB, b TEXT DEFAULT DECODE_HISTOGRAM(@SINGLE_PREC_TYPE,a));
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` blob DEFAULT NULL,
|
||||
`b` text DEFAULT decode_histogram('SINGLE_PREC_HB',`a`)
|
||||
`b` text DEFAULT decode_histogram(@`SINGLE_PREC_TYPE`,`a`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
INSERT INTO t1 (a) VALUES (0x0000000000000000000000000101010101010101010202020303030304040404050505050606070707080809090A0A0B0C0D0D0E0E0F10111213131415161718191B1C1E202224292A2E33373B4850575F6A76818C9AA7B9C4CFDADFE5EBF0F4F8FAFCFF);
|
||||
SELECT b FROM t1;
|
||||
|
Reference in New Issue
Block a user