Commit ffc5e00e authored by Alexey Botchkov's avatar Alexey Botchkov

MDEV-21915 Server crashes in copy_fields,Item_func_group_concat::add …

…while using json_arrayagg() as a window function.

We don't support JSON_ARRAYAGG and JSON_OBJECTAGG in window functions
yet.
parent 2e6b21be
......@@ -1221,3 +1221,14 @@ SELECT JSON_ARRAYAGG(a) FROM t1;
JSON_ARRAYAGG(a)
NULL
DROP TABLE t1;
#
# MDEV-21915 Server crashes in copy_fields,Item_func_group_concat::add
while using json_arrayagg() as a window function
#
select json_arrayagg(a) over () from (select 1 a) t;
ERROR 42000: This version of MariaDB doesn't yet support 'JSON_ARRAYAGG() aggregate as window function'
select json_objectagg(a, b) over () from (select 1 a, 2 b) t;
ERROR 42000: This version of MariaDB doesn't yet support 'JSON_OBJECTAGG() aggregate as window function'
#
# End of 10.5 tests
#
......@@ -740,3 +740,19 @@ DROP TABLE t1;
CREATE TABLE t1 (a INT);
SELECT JSON_ARRAYAGG(a) FROM t1;
DROP TABLE t1;
-- echo #
-- echo # MDEV-21915 Server crashes in copy_fields,Item_func_group_concat::add
-- echo while using json_arrayagg() as a window function
-- echo #
--error ER_NOT_SUPPORTED_YET
select json_arrayagg(a) over () from (select 1 a) t;
--error ER_NOT_SUPPORTED_YET
select json_objectagg(a, b) over () from (select 1 a, 2 b) t;
--echo #
--echo # End of 10.5 tests
--echo #
......@@ -579,7 +579,7 @@ class Item_func_json_objectagg : public Item_sum
bool is_json_type() { return true; }
void cleanup();
enum Sumfunctype sum_func () const {return GROUP_CONCAT_FUNC;}
enum Sumfunctype sum_func () const {return JSON_OBJECTAGG_FUNC;}
const char *func_name() const { return "json_objectagg("; }
const Type_handler *type_handler() const
{
......
......@@ -355,7 +355,8 @@ class Item_sum :public Item_func_or_sum
ROW_NUMBER_FUNC, RANK_FUNC, DENSE_RANK_FUNC, PERCENT_RANK_FUNC,
CUME_DIST_FUNC, NTILE_FUNC, FIRST_VALUE_FUNC, LAST_VALUE_FUNC,
NTH_VALUE_FUNC, LEAD_FUNC, LAG_FUNC, PERCENTILE_CONT_FUNC,
PERCENTILE_DISC_FUNC, SP_AGGREGATE_FUNC, JSON_ARRAYAGG_FUNC
PERCENTILE_DISC_FUNC, SP_AGGREGATE_FUNC, JSON_ARRAYAGG_FUNC,
JSON_OBJECTAGG_FUNC
};
Item **ref_by; /* pointer to a ref to the object used to register it */
......
......@@ -2936,6 +2936,14 @@ bool Window_func_runner::add_function_to_run(Item_window_func *win_func)
my_error(ER_NOT_SUPPORTED_YET, MYF(0),
"COUNT(DISTINCT) aggregate as window function");
return true;
case Item_sum::JSON_ARRAYAGG_FUNC:
my_error(ER_NOT_SUPPORTED_YET, MYF(0),
"JSON_ARRAYAGG() aggregate as window function");
return true;
case Item_sum::JSON_OBJECTAGG_FUNC:
my_error(ER_NOT_SUPPORTED_YET, MYF(0),
"JSON_OBJECTAGG() aggregate as window function");
return true;
default:
break;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment