1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Store bucket bounds and extend test cases for JSON histogram

This fixes the memory allocation for json histogram builder and add more column types for testing.
Some challenges at the moment include:
* Garbage value at the end of JSON array still persists.
* Garbage value also gets appended to bucket values if the column is a primary key.
* There's a memory leak resulting in a "Warning: Memory not freed" message at the end of tests.

Signed-off-by: Michael Okoko <okokomichaels@outlook.com>
This commit is contained in:
Michael Okoko
2021-06-30 05:51:08 +01:00
committed by Sergei Petrunia
parent 237447de63
commit 9954aecc2b
4 changed files with 57 additions and 26 deletions

View File

@ -153,9 +153,9 @@ private:
{
switch (type) {
case SINGLE_PREC_HB:
case JSON:
return ((uint) (1 << 8) - 1);
case DOUBLE_PREC_HB:
case JSON:
return ((uint) (1 << 16) - 1);
}
return 1;
@ -166,9 +166,9 @@ public:
{
switch (type) {
case SINGLE_PREC_HB:
case JSON:
return size;
case DOUBLE_PREC_HB:
case JSON:
return size / 2;
}
return 0;
@ -180,9 +180,9 @@ private:
DBUG_ASSERT(i < get_width());
switch (type) {
case SINGLE_PREC_HB:
case JSON:
return (uint) (((uint8 *) values)[i]);
case DOUBLE_PREC_HB:
case JSON:
return (uint) uint2korr(values + i * 2);
}
return 0;