fix returned value type for empty json objects

Signed-off-by: Michael Okoko <okokomichaels@outlook.com>
This commit is contained in:
Michael Okoko 2021-08-11 07:19:39 +01:00 committed by Sergei Petrunia
parent 69f24c238e
commit c605285bb8
2 changed files with 2 additions and 3 deletions

View File

@ -101,7 +101,7 @@ ERROR HY000: Failed to parse histogram, encountered JSON_TYPE '1'.
UPDATE mysql.column_stats SET histogram='{}' WHERE table_name='t1';
FLUSH TABLES;
SELECT * FROM t1;
ERROR HY000: Failed to parse histogram, encountered JSON_TYPE '32641'.
ERROR HY000: Failed to parse histogram, encountered JSON_TYPE '1'.
DELETE FROM mysql.column_stats;
DROP TABLE t1;
create schema world;

View File

@ -1993,11 +1993,10 @@ bool json_get_array_items(const char *json, const char *json_end, int *value_typ
json_scan_start(&je, &my_charset_utf8mb4_bin, (const uchar *)json, (const uchar *)json_end);
if (json_read_value(&je) || je.value_type != JSON_VALUE_ARRAY)
if (json_read_value(&je) || (*value_type = je.value_type) != JSON_VALUE_ARRAY)
{
return false;
}
*value_type = je.value_type;
std::string val;
while(!json_scan_next(&je))