Skip to content
Permalink
Browse files
MDEV-23437 Item_func_json_objectagg::print is not implemented.
Fix the Item_func_json_objectagg::fix_fields to save the orig_args.
  • Loading branch information
Alexey Botchkov committed Oct 23, 2020
1 parent bff82f5 commit 9df9915
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
@@ -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); }
};

0 comments on commit 9df9915

Please sign in to comment.