[Improve](json-array) Support json array with nereids bool (#20248)
Support json array with nereids bool now : ``` set enable_nereids_planner=true; mysql> SELECT json_array(1, "abc", NULL, TRUE, '10:00:00'); +----------------------------------------------+ | json_array(1, 'abc', NULL, TRUE, '10:00:00') | +----------------------------------------------+ | [1,"abc",null,false,"10:00:00"] | +----------------------------------------------+ 1 row in set (0.02 sec) ``` nereids boolean is "true"/"false" is not '0' /'1' , so we always get false
This commit is contained in:
@ -547,7 +547,9 @@ struct JsonParser<'1'> {
|
||||
// bool
|
||||
static void update_value(StringParser::ParseResult& result, rapidjson::Value& value,
|
||||
StringRef data, rapidjson::Document::AllocatorType& allocator) {
|
||||
value.SetBool((*data.data == '1') ? true : false);
|
||||
DCHECK(data.size == 1 || strncmp(data.data, "true", 4) == 0 ||
|
||||
strncmp(data.data, "false", 5) == 0);
|
||||
value.SetBool((*data.data == '1' || *data.data == 't') ? true : false);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user