Commit 9df99151 authored by Alexey Botchkov's avatar Alexey Botchkov

MDEV-23437 Item_func_json_objectagg::print is not implemented.

Fix the Item_func_json_objectagg::fix_fields to save the orig_args.
parent bff82f51
......@@ -1354,6 +1354,11 @@ e JSON_OBJECTAGG(B.a, B.v)
0 {"a1":"1", "a1":"1", "a1":"1"}
0 {"a2":"2", "a2":"2", "a2":"2"}
1 {"b1":"3", "b1":"3", "b1":"3"}
CREATE VIEW v AS SELECT JSON_OBJECTAGG(a, e) FROM t1;
SELECT * FROM v;
JSON_OBJECTAGG(a, e)
{"a1":0, "a2":0, "b1":1}
DROP VIEW v;
DROP TABLE t1;
#
# End of 10.5 tests
......
......@@ -849,6 +849,10 @@ INSERT INTO t1 VALUES (0, 'a1', '1') , (0, 'a2', '2') , (1, 'b1', '3');
EXPLAIN SELECT B.e, JSON_OBJECTAGG(B.a, B.v) FROM t1 A, t1 B GROUP BY B.e, B.a;
SELECT B.e, JSON_OBJECTAGG(B.a, B.v) FROM t1 A, t1 B GROUP BY B.e, B.a;
CREATE VIEW v AS SELECT JSON_OBJECTAGG(a, e) FROM t1;
SELECT * FROM v;
DROP VIEW v;
DROP TABLE t1;
--echo #
......
......@@ -3772,6 +3772,8 @@ Item_func_json_objectagg::fix_fields(THD *thd, Item **ref)
uint i; /* for loop variable */
DBUG_ASSERT(fixed == 0);
memcpy(orig_args, args, sizeof(Item*) * arg_count);
if (init_sum_func_check(thd))
return TRUE;
......@@ -3867,7 +3869,3 @@ String* Item_func_json_objectagg::val_str(String* str)
}
void Item_func_json_objectagg::print(String *str, enum_query_type query_type)
{
}
......@@ -589,7 +589,7 @@ class Item_func_json_objectagg : public Item_sum
void cleanup();
enum Sumfunctype sum_func () const {return JSON_OBJECTAGG_FUNC;}
const char *func_name() const { return "json_objectagg("; }
const char *func_name() const { return "json_objectagg"; }
const Type_handler *type_handler() const
{
if (too_big_for_varchar())
......@@ -618,7 +618,6 @@ class Item_func_json_objectagg : public Item_sum
String* val_str(String* str);
Item *copy_or_same(THD* thd);
void no_rows_in_result() {}
void print(String *str, enum_query_type query_type);
Item *get_copy(THD *thd)
{ return get_item_copy<Item_func_json_objectagg>(thd, this); }
};
......
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