1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

MDEV-26519: Improved histograms: Make JSON parser efficient

Previous JSON parser was using an API which made the parsing
inefficient: the same JSON contents was parsed again and again.

Switch to using a lower-level parsing API which allows to do
parsing in an efficient way.
This commit is contained in:
Sergei Petrunia
2021-12-02 11:54:10 +03:00
parent be55ad0d34
commit 1d14176ec4
7 changed files with 358 additions and 188 deletions

View File

@@ -1233,7 +1233,8 @@ public:
if (!(hist= create_histogram(mem_root, hist_type, NULL)))
return NULL;
Field *field= table->field[table_field->field_index];
if (!hist->parse(mem_root, field, hist_type,
if (!hist->parse(mem_root, db_name->str, table_name->str,
field, hist_type,
val.ptr(), val.length()))
{
table_field->read_stats->histogram= hist;
@@ -1247,9 +1248,9 @@ public:
};
bool Histogram_binary::parse(MEM_ROOT *mem_root, Field*,
Histogram_type type_arg, const char *hist_data,
size_t hist_data_len)
bool Histogram_binary::parse(MEM_ROOT *mem_root, const char*, const char*,
Field*, Histogram_type type_arg,
const char *hist_data, size_t hist_data_len)
{
/* On-disk an in-memory formats are the same. Just copy the data. */
type= type_arg;