mirror of
https://github.com/MariaDB/server.git
synced 2025-01-29 02:05:57 +01:00
Code cleanup
This commit is contained in:
parent
f7e49c98e6
commit
ce4956f322
7 changed files with 14 additions and 28 deletions
|
@ -282,15 +282,6 @@ int json_key_matches(json_engine_t *je, json_string_t *k);
|
||||||
*/
|
*/
|
||||||
int json_read_value(json_engine_t *j);
|
int json_read_value(json_engine_t *j);
|
||||||
|
|
||||||
/*
|
|
||||||
json_smart_read_value() reads a JSON value. Pointer to value is stored in
|
|
||||||
*value and its length in *value_len.
|
|
||||||
|
|
||||||
if the value is non a scalar, it returns pointers to its JSON
|
|
||||||
representation.
|
|
||||||
The function should only be called when je->state==JST_VALUE.
|
|
||||||
*/
|
|
||||||
enum json_types json_smart_read_value(json_engine_t *je, const char **value, int *value_len);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
json_skip_key() makes parser skip the content of the current
|
json_skip_key() makes parser skip the content of the current
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
# The time on ANALYSE FORMAT=JSON is rather variable
|
# Remove non-deterministic parts of JSON_HB histogram
|
||||||
|
|
||||||
--replace_regex /("(collected_at|collected_by)": )"[^"]*"/\1"REPLACED"/
|
--replace_regex /("(collected_at|collected_by)": )"[^"]*"/\1"REPLACED"/
|
||||||
|
|
|
@ -914,7 +914,7 @@ double position_in_interval(Field *field, const uchar *key, uint key_len,
|
||||||
|
|
||||||
|
|
||||||
double Histogram_json_hb::point_selectivity(Field *field, key_range *endpoint,
|
double Histogram_json_hb::point_selectivity(Field *field, key_range *endpoint,
|
||||||
double avg_sel, double total_rows)
|
double avg_sel)
|
||||||
{
|
{
|
||||||
const uchar *key = endpoint->key;
|
const uchar *key = endpoint->key;
|
||||||
if (field->real_maybe_null())
|
if (field->real_maybe_null())
|
||||||
|
|
|
@ -41,8 +41,8 @@
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
The histogram is an object with single member named Histogram_json_hb::
|
Histogram is a JSON object. It has some global properties and "histogram_hb"
|
||||||
JSON_NAME. The value of that member is an array of buckets.
|
member whose value is a JSON array of histogram buckets.
|
||||||
|
|
||||||
Each bucket is an object with these members:
|
Each bucket is an object with these members:
|
||||||
"start" - the first value in the bucket.
|
"start" - the first value in the bucket.
|
||||||
|
@ -126,8 +126,7 @@ public:
|
||||||
ulonglong size) override;
|
ulonglong size) override;
|
||||||
|
|
||||||
double point_selectivity(Field *field, key_range *endpoint,
|
double point_selectivity(Field *field, key_range *endpoint,
|
||||||
double avg_selection,
|
double avg_sel) override;
|
||||||
double total_rows) override;
|
|
||||||
double range_selectivity(Field *field, key_range *min_endp,
|
double range_selectivity(Field *field, key_range *min_endp,
|
||||||
key_range *max_endp, double avg_sel) override;
|
key_range *max_endp, double avg_sel) override;
|
||||||
|
|
||||||
|
|
|
@ -3894,8 +3894,7 @@ double get_column_range_cardinality(Field *field,
|
||||||
{
|
{
|
||||||
res= col_non_nulls *
|
res= col_non_nulls *
|
||||||
hist->point_selectivity(field, min_endp,
|
hist->point_selectivity(field, min_endp,
|
||||||
avg_frequency / col_non_nulls,
|
avg_frequency / col_non_nulls);
|
||||||
tab_records);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (avg_frequency == 0.0)
|
else if (avg_frequency == 0.0)
|
||||||
|
@ -3989,8 +3988,7 @@ double get_column_range_cardinality(Field *field,
|
||||||
*/
|
*/
|
||||||
|
|
||||||
double Histogram_binary::point_selectivity(Field *field, key_range *endpoint,
|
double Histogram_binary::point_selectivity(Field *field, key_range *endpoint,
|
||||||
double avg_sel,
|
double avg_sel)
|
||||||
double total_records)
|
|
||||||
{
|
{
|
||||||
double sel;
|
double sel;
|
||||||
Column_statistics *col_stats= field->read_stats;
|
Column_statistics *col_stats= field->read_stats;
|
||||||
|
|
|
@ -188,8 +188,7 @@ public:
|
||||||
|
|
||||||
|
|
||||||
virtual double point_selectivity(Field *field, key_range *endpoint,
|
virtual double point_selectivity(Field *field, key_range *endpoint,
|
||||||
double avg_selectivity,
|
double avg_sel)=0;
|
||||||
double total_rows)=0;
|
|
||||||
virtual double range_selectivity(Field *field, key_range *min_endp,
|
virtual double range_selectivity(Field *field, key_range *min_endp,
|
||||||
key_range *max_endp, double avg_sel)=0;
|
key_range *max_endp, double avg_sel)=0;
|
||||||
|
|
||||||
|
@ -359,8 +358,7 @@ public:
|
||||||
Estimate selectivity of "col=const" using a histogram
|
Estimate selectivity of "col=const" using a histogram
|
||||||
*/
|
*/
|
||||||
double point_selectivity(Field *field, key_range *endpoint,
|
double point_selectivity(Field *field, key_range *endpoint,
|
||||||
double avg_sel,
|
double avg_sel) override;
|
||||||
double total_rows) override;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1868,7 +1868,7 @@ int json_path_compare(const json_path_t *a, const json_path_t *b,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
enum json_types json_smart_read_value(json_engine_t *je,
|
static enum json_types smart_read_value(json_engine_t *je,
|
||||||
const char **value, int *value_len)
|
const char **value, int *value_len)
|
||||||
{
|
{
|
||||||
if (json_read_value(je))
|
if (json_read_value(je))
|
||||||
|
@ -1909,7 +1909,7 @@ enum json_types json_type(const char *js, const char *js_end,
|
||||||
json_scan_start(&je, &my_charset_utf8mb4_bin,(const uchar *) js,
|
json_scan_start(&je, &my_charset_utf8mb4_bin,(const uchar *) js,
|
||||||
(const uchar *) js_end);
|
(const uchar *) js_end);
|
||||||
|
|
||||||
return json_smart_read_value(&je, value, value_len);
|
return smart_read_value(&je, value, value_len);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1933,7 +1933,7 @@ enum json_types json_get_array_item(const char *js, const char *js_end,
|
||||||
{
|
{
|
||||||
case JST_VALUE:
|
case JST_VALUE:
|
||||||
if (c_item == n_item)
|
if (c_item == n_item)
|
||||||
return json_smart_read_value(&je, value, value_len);
|
return smart_read_value(&je, value, value_len);
|
||||||
|
|
||||||
if (json_skip_key(&je))
|
if (json_skip_key(&je))
|
||||||
goto err_return;
|
goto err_return;
|
||||||
|
@ -1998,7 +1998,7 @@ enum json_types json_get_object_key(const char *js, const char *js_end,
|
||||||
json_string_set_str(&key_name, (const uchar *) key,
|
json_string_set_str(&key_name, (const uchar *) key,
|
||||||
(const uchar *) key_end);
|
(const uchar *) key_end);
|
||||||
if (json_key_matches(&je, &key_name))
|
if (json_key_matches(&je, &key_name))
|
||||||
return json_smart_read_value(&je, value, value_len);
|
return smart_read_value(&je, value, value_len);
|
||||||
|
|
||||||
if (json_skip_key(&je))
|
if (json_skip_key(&je))
|
||||||
goto err_return;
|
goto err_return;
|
||||||
|
|
Loading…
Add table
Reference in a new issue