Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
ce4956f3
Commit
ce4956f3
authored
Jan 19, 2022
by
Sergei Petrunia
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Code cleanup
parent
f7e49c98
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
14 additions
and
28 deletions
+14
-28
include/json_lib.h
include/json_lib.h
+0
-9
mysql-test/include/json_hb_histogram.inc
mysql-test/include/json_hb_histogram.inc
+1
-1
sql/opt_histogram_json.cc
sql/opt_histogram_json.cc
+1
-1
sql/opt_histogram_json.h
sql/opt_histogram_json.h
+3
-4
sql/sql_statistics.cc
sql/sql_statistics.cc
+2
-4
sql/sql_statistics.h
sql/sql_statistics.h
+2
-4
strings/json_lib.c
strings/json_lib.c
+5
-5
No files found.
include/json_lib.h
View file @
ce4956f3
...
...
@@ -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
...
...
mysql-test/include/json_hb_histogram.inc
View file @
ce4956f3
#
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
"/
sql/opt_histogram_json.cc
View file @
ce4956f3
...
...
@@ -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
())
...
...
sql/opt_histogram_json.h
View file @
ce4956f3
...
...
@@ -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 @@ class Histogram_json_hb : public Histogram_base
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
;
...
...
sql/sql_statistics.cc
View file @
ce4956f3
...
...
@@ -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
;
...
...
sql/sql_statistics.h
View file @
ce4956f3
...
...
@@ -188,8 +188,7 @@ class Histogram_base
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 @@ class Histogram_binary : public Histogram_base
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
;
};
...
...
strings/json_lib.c
View file @
ce4956f3
...
...
@@ -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
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment