mirror of
https://github.com/MariaDB/server.git
synced 2025-01-15 19:42:28 +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);
|
||||
|
||||
/*
|
||||
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
|
||||
|
|
|
@ -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"/
|
||||
|
|
|
@ -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 avg_sel, double total_rows)
|
||||
double avg_sel)
|
||||
{
|
||||
const uchar *key = endpoint->key;
|
||||
if (field->real_maybe_null())
|
||||
|
|
|
@ -41,8 +41,8 @@
|
|||
]
|
||||
}
|
||||
|
||||
The histogram is an object with single member named Histogram_json_hb::
|
||||
JSON_NAME. The value of that member is an array of buckets.
|
||||
Histogram is a JSON object. It has some global properties and "histogram_hb"
|
||||
member whose value is a JSON array of histogram buckets.
|
||||
|
||||
Each bucket is an object with these members:
|
||||
"start" - the first value in the bucket.
|
||||
|
@ -126,8 +126,7 @@ public:
|
|||
ulonglong size) override;
|
||||
|
||||
double point_selectivity(Field *field, key_range *endpoint,
|
||||
double avg_selection,
|
||||
double total_rows) override;
|
||||
double avg_sel) override;
|
||||
double range_selectivity(Field *field, key_range *min_endp,
|
||||
key_range *max_endp, double avg_sel) override;
|
||||
|
||||
|
|
|
@ -3894,8 +3894,7 @@ double get_column_range_cardinality(Field *field,
|
|||
{
|
||||
res= col_non_nulls *
|
||||
hist->point_selectivity(field, min_endp,
|
||||
avg_frequency / col_non_nulls,
|
||||
tab_records);
|
||||
avg_frequency / col_non_nulls);
|
||||
}
|
||||
}
|
||||
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 avg_sel,
|
||||
double total_records)
|
||||
double avg_sel)
|
||||
{
|
||||
double sel;
|
||||
Column_statistics *col_stats= field->read_stats;
|
||||
|
|
|
@ -188,8 +188,7 @@ public:
|
|||
|
||||
|
||||
virtual double point_selectivity(Field *field, key_range *endpoint,
|
||||
double avg_selectivity,
|
||||
double total_rows)=0;
|
||||
double avg_sel)=0;
|
||||
virtual double range_selectivity(Field *field, key_range *min_endp,
|
||||
key_range *max_endp, double avg_sel)=0;
|
||||
|
||||
|
@ -359,8 +358,7 @@ public:
|
|||
Estimate selectivity of "col=const" using a histogram
|
||||
*/
|
||||
double point_selectivity(Field *field, key_range *endpoint,
|
||||
double avg_sel,
|
||||
double total_rows) override;
|
||||
double avg_sel) override;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -1868,8 +1868,8 @@ 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,
|
||||
const char **value, int *value_len)
|
||||
static enum json_types smart_read_value(json_engine_t *je,
|
||||
const char **value, int *value_len)
|
||||
{
|
||||
if (json_read_value(je))
|
||||
goto err_return;
|
||||
|
@ -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,
|
||||
(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:
|
||||
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))
|
||||
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,
|
||||
(const uchar *) key_end);
|
||||
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))
|
||||
goto err_return;
|
||||
|
|
Loading…
Reference in a new issue