inform test result of zero hist_size for json histogram

Signed-off-by: Michael Okoko <okokomichaels@outlook.com>
This commit is contained in:
Michael Okoko 2021-07-31 20:21:38 +01:00 committed by Sergei Petrunia
parent bf4d0dcfe2
commit fe2e516a50
3 changed files with 7 additions and 8 deletions

View File

@ -19,7 +19,7 @@ test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK test.t1 analyze status OK
SELECT * FROM mysql.column_stats WHERE table_name='t1'; SELECT * FROM mysql.column_stats WHERE table_name='t1';
db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram
test t1 a 1 25 0.0000 4.0000 1.0000 10 JSON [ test t1 a 1 25 0.0000 4.0000 0.0000 10 JSON [
"3", "3",
"5", "5",
"7", "7",
@ -31,7 +31,7 @@ test t1 a 1 25 0.0000 4.0000 1.0000 10 JSON [
"21", "21",
"23" "23"
] ]
test t1 b 1 9 0.0000 1.6400 1.0000 10 JSON [ test t1 b 1 9 0.0000 1.6400 0.0000 10 JSON [
"11", "11",
"13", "13",
"15", "15",
@ -43,7 +43,7 @@ test t1 b 1 9 0.0000 1.6400 1.0000 10 JSON [
"5", "5",
"7" "7"
] ]
test t1 c 1 9 0.0000 2.0000 1.0000 10 JSON [ test t1 c 1 9 0.0000 2.0000 0.0000 10 JSON [
"11", "11",
"13", "13",
"15", "15",
@ -55,7 +55,7 @@ test t1 c 1 9 0.0000 2.0000 1.0000 10 JSON [
"5", "5",
"7" "7"
] ]
test t1 d 1 25 0.0000 8.0000 1.0000 10 JSON [ test t1 d 1 25 0.0000 8.0000 0.0000 10 JSON [
"3", "3",
"5", "5",
"7", "7",

View File

@ -1283,7 +1283,6 @@ void Histogram_json::init_for_collection(MEM_ROOT *mem_root, Histogram_type htyp
bool Histogram_json::parse(MEM_ROOT *mem_root, Histogram_type type_arg, const uchar *ptr, uint size_arg) bool Histogram_json::parse(MEM_ROOT *mem_root, Histogram_type type_arg, const uchar *ptr, uint size_arg)
{ {
size = (uint8) size_arg;
type = type_arg; type = type_arg;
// I think we could use memcpy here, but not sure about how to get the right size // I think we could use memcpy here, but not sure about how to get the right size
// since we can't depend on size_arg (it's zero for json histograms) // since we can't depend on size_arg (it's zero for json histograms)
@ -1303,7 +1302,7 @@ bool Histogram_json::parse(MEM_ROOT *mem_root, Histogram_type type_arg, const uc
void Histogram_json::serialize(Field *field) void Histogram_json::serialize(Field *field)
{ {
field->store((char*)get_values(), strlen((char*)get_values()), field->store((char*)values, strlen((char*)values),
&my_charset_bin); &my_charset_bin);
} }

View File

@ -372,9 +372,9 @@ public:
is_available(); is_available();
} }
void set_values (uchar *vals) override { values= (uchar *) vals; } void set_values (uchar *vals) override { values= vals; }
uchar *get_values() override { return (uchar *) values; } uchar *get_values() override { return values; }
double range_selectivity(double min_pos, double max_pos) override {return 0.1;} double range_selectivity(double min_pos, double max_pos) override {return 0.1;}