Commit graph

241 commits

Author SHA1 Message Date
Hollow Man
f386fdd70e Fix several typos in sql/item_jsonfunc.cc
insencitive -> insensitive
excapint -> excipient
Jost -> Just
belive -> believe
2021-03-11 13:25:44 +11:00
Marko Mäkelä
898521e2dd Merge 10.4 into 10.5 2020-10-30 11:15:30 +02:00
Marko Mäkelä
7b2bb67113 Merge 10.3 into 10.4 2020-10-29 13:38:38 +02:00
Marko Mäkelä
a8de8f261d Merge 10.2 into 10.3 2020-10-28 10:01:50 +02:00
Alexey Botchkov
9df99151da MDEV-23437 Item_func_json_objectagg::print is not implemented.
Fix the Item_func_json_objectagg::fix_fields to save the orig_args.
2020-10-24 00:16:56 +04:00
Alexey Botchkov
21ea14db8c MDEV-20593 SIGSEGV in report_json_error_ex (on optimized builds).
When first argument to the JSON_MERGE_PATCH was NULL and second - the
invalid JSON line, the error code was garbage. So it should be set to 0
initially.
2020-10-22 15:51:14 +04:00
Marko Mäkelä
1813d92d0c Merge 10.4 into 10.5 2020-07-02 09:41:44 +03:00
Marko Mäkelä
f347b3e0e6 Merge 10.3 into 10.4 2020-07-02 07:39:33 +03:00
Marko Mäkelä
1df1a63924 Merge 10.2 into 10.3 2020-07-02 06:17:51 +03:00
Varun Gupta
7e19954b9a MDEV-23029: JSON_OBJECTAGG returns NULL when used together with GROUP BY
Quick grouping is not supported for JSON_OBJECTAGG. The same for GROUP_CONCAT too
so make sure that Item::quick_group is set to FALSE. We need to make sure that in
the case of JSON_OBJECTAGG we don't create an index over grouping fields of
the temp table and update the result after each iteration.
Instead we should first sort the result in accordance to the
GROUP BY fields and then perform the grouping and
write the result to the temp table.
2020-06-29 20:06:28 +05:30
Alexander Barkov
30903c3743 MDEV-22976 CAST(JSON_EXTRACT() AS DECIMAL) does not handle boolean values
Item_func_json_extract did not implement val_decimal(),
so CAST(JSON_EXTRACT('{"x":true}', '$.x') AS DECIMAL) erroneously
returned 0 with a warning because of convertion from the string "true"
to decimal.

Implementing val_decimal(), so boolean values are correctly handled.
2020-06-22 15:43:53 +04:00
Alexey Botchkov
6c573a9146 MDEV-22844 JSON_ARRAYAGG is limited by group_concat_max_len.
Warning message and function result fixed
2020-06-15 22:51:21 +04:00
Varun Gupta
0f6f0daa4d MDEV-22011: DISTINCT with JSON_ARRAYAGG gives wrong results
For DISTINCT to be handled with JSON_ARRAYAGG, we need to make sure
that the Unique tree also holds the NULL bytes of a table record
inside the node of the tree. This behaviour for JSON_ARRAYAGG is
different from GROUP_CONCAT because in GROUP_CONCAT we just reject
NULL values for columns.

Also introduced a comparator function for the unique tree to handle null
values for distinct inside JSON_ARRAYAGG.
2020-06-12 23:47:38 +05:30
Alexey Botchkov
74198384e1 MDEV-21914 JSON_ARRAYAGG doesn't reject ORDER BY clause, but doesn't work either.
ORDER BY fixed for JSON_ARRAYAGG.
2020-06-04 13:53:14 +04:00
Alexey Botchkov
bb47050e1f MDEV-22640, MDEV-22449, MDEV-21528 JSON_ARRAYAGG crashes with NULL values.
We have to include NULL in the result which the GOUP_CONCAT doesn't
always do. Also converting should be done into another String instance
as these can be same.
2020-06-04 10:00:56 +04:00
Alexey Botchkov
e545a60bf4 MDEV-22236 JSON_ARRAYAGG query leads to SIGSEGV in Charset::swap on optimized builds.
The json_arrayagg::val_str should handle NULL result.
2020-04-28 16:08:18 +04:00
Alexander Barkov
f1e13fdc8d MDEV-21581 Helper functions and methods for CHARSET_INFO 2020-01-28 12:29:23 +04:00
Alexey Botchkov
ba8e5e689c MDEV-16620 JSON_ARRAYAGG and JSON_OBJECTAGG.
Ison_objectagg implemented.
2019-10-14 14:24:22 +04:00
Markus Mäkelä
d0fc07c85f
MDEV-16620: Add JSON_ARRAYAGG function
The JSON_ARRAYAGG function extends the GROUP_CONCAT function and provides
a method of aggregating JSON results. The current implementation supports
DISTINCT and LIMIT but not ORDER BY (Oracle supports GROUP BY).

Adding GROUP BY support is possible but it requires some extra work as the
grouping appears to be done inside a temporary table that complicates
matters.

Added test cases that covert aggregation of all JSON types and JSON
validation for the generated results.
2019-07-04 13:12:08 +03:00
Alexander Barkov
3e7e87ddcc MDEV-19897 Rename source code variable names from utf8 to utf8mb3 2019-06-28 12:37:04 +04:00
Alexander Barkov
323a87b591 MDEV-19888 Add abstract class Item_json_func 2019-06-28 12:35:02 +04:00
Oleksandr Byelkin
c07325f932 Merge branch '10.3' into 10.4 2019-05-19 20:55:37 +02:00
Sergei Golubchik
c1fd027115 Merge branch '10.2' into 10.3 2019-05-17 17:23:01 +02:00
Alexey Botchkov
cd16d6d518 MDEV-13992 Implement JSON_MERGE_PATCH.
JSON_MERGE_PATCH implemented. Added JSON_MERGE_PRESERVE as a synonim for
the JSON_MERGE.
2019-05-17 11:53:58 +04:00
Marko Mäkelä
514b305dfb Merge 10.3 into 10.4
The MDEV-17262 commit 26432e49d3
was skipped. In Galera 4, the implementation would seem to require
changes to the streaming replication.

In the tests archive.rnd_pos main.profiling, disable_ps_protocol
for SHOW STATUS and SHOW PROFILE commands until MDEV-18974
has been fixed.
2019-03-20 10:41:32 +02:00
Sergei Golubchik
b64fde8f38 Merge branch '10.2' into 10.3 2019-03-17 13:06:41 +01:00
Sergei Golubchik
f1134d5676 post-merge: gcc 8 warnings
note: Inherit String from Sql_alloc,
to get operators new and new[] in sync

in rocksdb gcc was complaining that non-lvalue was cast to const.
2019-03-15 21:00:50 +01:00
Marko Mäkelä
e450527938 Merge 10.3 into 10.4 2019-03-12 16:14:31 +02:00
Marko Mäkelä
b32bc70e34 Merge 10.2 into 10.3 2019-03-12 14:26:34 +02:00
Alexey Botchkov
acb4a87204 MDEV-18886 JSON_ARRAY() does not recognise JSON argument.
JSON_ARRAY and JSON_OBJECT functions with no arguments now get the
connection charset. Item_func_convert_charset returns the correct
is_json() flag.
2019-03-12 01:09:55 +04:00
Sergei Golubchik
d68d7e50f9 json helpers 2018-12-12 00:31:43 +01:00
Marko Mäkelä
dde2ca4aa1 Merge 10.3 into 10.4 2018-11-19 20:22:33 +02:00
Marko Mäkelä
fd58bb71e2 Merge 10.2 into 10.3 2018-11-19 18:45:53 +02:00
Alexey Botchkov
5cfb043d29 MDEV-16174 Assertion `0' failed in Type_handler_string_result::make_sort_key(uchar*, Item*, const SORT_FIELD_ATTR*, Sort_param*)
maybe_null should be always set to TRUE in
Item_func_json_array_append::fix_length_and_dec()
2018-11-09 22:55:34 +04:00
Marko Mäkelä
444c380ceb Merge 10.3 into 10.4 2018-10-05 08:09:49 +03:00
Sergei Golubchik
57e0da50bb Merge branch '10.2' into 10.3 2018-09-28 16:37:06 +02:00
Alexey Botchkov
f54485eadb MDEV-17001 JSON_MERGE returns nullwhen merging empty array.
Don't add the comma if nothing appended to the array.
2018-09-13 13:42:09 +04:00
Alexey Botchkov
a93363022c MDEV-17018 JSON_SEARCH and User-Defined Variables.
Item_func_json_search needs a member to store the path.
2018-09-12 21:57:28 +04:00
Alexey Botchkov
c8bb43a938 MDEV-17121 JSON_ARRAY_APPEND.
Extra comma added to the result when an json array is empty.
2018-09-11 14:37:45 +04:00
Marko Mäkelä
734db318ac Merge 10.3 into 10.4 2018-08-16 10:08:30 +03:00
Sergei Golubchik
0aa9b03393 Merge branch '10.2' into 10.3 2018-08-12 12:02:23 +02:00
Alexey Botchkov
4ddcb4eb46 MDEV-16750 JSON_SET mishandles unicode every second pair of arguments.
The charset of temporary storage (Item_func_json_insert::tmp_js)
  was not properly set.
2018-08-06 13:37:09 +04:00
Alexey Botchkov
fc324a5f87 MDEV-16869 String functions don't respect character set of JSON_VALUE.
Item_func_json_value::val_str() produced string of wrong charset.
2018-08-05 18:33:17 +04:00
Alexander Barkov
9c0f5a252b Merge remote-tracking branch 'origin/10.3' into 10.4 2018-07-25 08:25:57 +04:00
Alexander Barkov
294a426088 Merge remote-tracking branch 'origin/10.2' into 10.3 2018-07-24 18:44:49 +04:00
Alexander Barkov
a8227a1543 MDEV-16814 CREATE TABLE SELECT JSON_QUOTE(multibyte_charset_expr) makes a field of a wrong length 2018-07-24 18:15:15 +04:00
Alexander Barkov
e61568ee93 Merge remote-tracking branch 'origin/10.3' into 10.4 2018-07-03 14:02:05 +04:00
Sergei Golubchik
36e59752e7 Merge branch '10.2' into 10.3 2018-06-30 16:39:20 +02:00
Oleksandr Byelkin
083279f783 Merge commit '6b8802e8dd5467556a024d807a1df23940b00895' into bb-10.3-fix_len_dec 2018-06-19 14:51:50 +02:00
Alexey Botchkov
5ba6cee012 MDEV-16209 JSON_EXTRACT in query crashes server.
The optimizer can create various item's over the original one,
    so we can't count on the exact item's type inside the comparison.
2018-06-18 23:00:34 +04:00