Commit d788225b authored by Olivier Bertrand's avatar Olivier Bertrand

Fix bson_object_grp inverted args. Modified: storage/connect/bsonudf.cpp and bson_udf.result

parent ca630041
...@@ -3019,7 +3019,7 @@ void bson_object_grp_add(UDF_INIT *initid, UDF_ARGS *args, char*, char*) ...@@ -3019,7 +3019,7 @@ void bson_object_grp_add(UDF_INIT *initid, UDF_ARGS *args, char*, char*)
PBVAL bop = (PBVAL)g->Activityp; PBVAL bop = (PBVAL)g->Activityp;
if (g->N-- > 0) if (g->N-- > 0)
bxp->SetKeyValue(bop, bxp->MakeValue(args, 0), MakePSZ(g, args, 1)); bxp->SetKeyValue(bop, bxp->MakeValue(args, 1), MakePSZ(g, args, 0));
} // end of bson_object_grp_add } // end of bson_object_grp_add
......
...@@ -280,13 +280,13 @@ SELECT Bson_Object_Grp(SALARY) FROM t3; ...@@ -280,13 +280,13 @@ SELECT Bson_Object_Grp(SALARY) FROM t3;
ERROR HY000: Can't initialize function 'bson_object_grp'; This function requires 2 arguments (key, value) ERROR HY000: Can't initialize function 'bson_object_grp'; This function requires 2 arguments (key, value)
SELECT Bson_Object_Grp(NAME, SALARY) FROM t3; SELECT Bson_Object_Grp(NAME, SALARY) FROM t3;
Bson_Object_Grp(NAME, SALARY) Bson_Object_Grp(NAME, SALARY)
{"":"MARTIN","ffffp@":"KITTY"} {"BANCROFT":9600.00,"SMITH":9000.00,"MERCHANT":8700.00,"FUNNIGUY":8500.00,"BUGHAPPY":8500.00,"BIGHEAD":8000.00,"SHRINKY":7500.00,"WALTER":7400.00,"FODDERMAN":7000.00,"TONGHO":6800.00,"SHORTSIGHT":5500.00,"MESSIFUL":5000.50,"HONEY":4900.00,"GOOSEPEN":4700.00,"CHERRY":4500.00,"MONAPENNY":3800.00,"KITTY":3000.45,"PLUMHEAD":2800.00,"STRONG":23000.00,"BULLOZER":14800.00,"WERTHER":14500.00,"QUINN":14000.00,"ORELLY":13400.00,"BIGHORN":11000.00,"BROWNY":10500.00,"WHEELFOR":10030.00,"MARTIN":10000.00}
SELECT Bson_Make_Object(DEPARTMENT, Bson_Object_Grp(NAME, SALARY) "Json_SALARIES") FROM t3 GROUP BY DEPARTMENT; SELECT Bson_Make_Object(DEPARTMENT, Bson_Object_Grp(NAME, SALARY) "Json_SALARIES") FROM t3 GROUP BY DEPARTMENT;
Bson_Make_Object(DEPARTMENT, Bson_Object_Grp(NAME, SALARY) "Json_SALARIES") Bson_Make_Object(DEPARTMENT, Bson_Object_Grp(NAME, SALARY) "Json_SALARIES")
{"DEPARTMENT":"0021","SALARIES":{"":"SHORTSIGHT"}} {"DEPARTMENT":"0021","SALARIES":{"STRONG":23000.00,"SHORTSIGHT":5500.00}}
{"DEPARTMENT":"0318","SALARIES":{"":"WHEELFOR"}} {"DEPARTMENT":"0318","SALARIES":{"BANCROFT":9600.00,"PLUMHEAD":2800.00,"HONEY":4900.00,"TONGHO":6800.00,"WALTER":7400.00,"SHRINKY":7500.00,"WERTHER":14500.00,"MERCHANT":8700.00,"WHEELFOR":10030.00}}
{"DEPARTMENT":"0319","SALARIES":{"":"GOOSEPEN","ffffp@":"KITTY"}} {"DEPARTMENT":"0319","SALARIES":{"BULLOZER":14800.00,"QUINN":14000.00,"BROWNY":10500.00,"KITTY":3000.45,"MONAPENNY":3800.00,"MARTIN":10000.00,"FUNNIGUY":8500.00,"BUGHAPPY":8500.00,"FODDERMAN":7000.00,"MESSIFUL":5000.50,"GOOSEPEN":4700.00}}
{"DEPARTMENT":"2452","SALARIES":{"":"CHERRY"}} {"DEPARTMENT":"2452","SALARIES":{"BIGHEAD":8000.00,"ORELLY":13400.00,"BIGHORN":11000.00,"SMITH":9000.00,"CHERRY":4500.00}}
SELECT Bson_Array_Grp(NAME) FROM t3; SELECT Bson_Array_Grp(NAME) FROM t3;
Bson_Array_Grp(NAME) Bson_Array_Grp(NAME)
["BANCROFT","SMITH","MERCHANT","FUNNIGUY","BUGHAPPY","BIGHEAD","SHRINKY","WALTER","FODDERMAN","TONGHO","SHORTSIGHT","MESSIFUL","HONEY","GOOSEPEN","CHERRY","MONAPENNY","KITTY","PLUMHEAD","STRONG","BULLOZER","WERTHER","QUINN","ORELLY","BIGHORN","BROWNY","WHEELFOR","MARTIN"] ["BANCROFT","SMITH","MERCHANT","FUNNIGUY","BUGHAPPY","BIGHEAD","SHRINKY","WALTER","FODDERMAN","TONGHO","SHORTSIGHT","MESSIFUL","HONEY","GOOSEPEN","CHERRY","MONAPENNY","KITTY","PLUMHEAD","STRONG","BULLOZER","WERTHER","QUINN","ORELLY","BIGHORN","BROWNY","WHEELFOR","MARTIN"]
...@@ -303,7 +303,7 @@ Bson_Object_Key(name, title) ...@@ -303,7 +303,7 @@ Bson_Object_Key(name, title)
{"WHEELFOR":"SALESMAN"} {"WHEELFOR":"SALESMAN"}
SELECT Bson_Object_Grp(name, title) FROM t3 WHERE DEPARTMENT = 318; SELECT Bson_Object_Grp(name, title) FROM t3 WHERE DEPARTMENT = 318;
Bson_Object_Grp(name, title) Bson_Object_Grp(name, title)
{"SALESMAN":"WHEELFOR","ADMINISTRATOR":"SHRINKY","ENGINEER":"TONGHO","SECRETARY":"HONEY","TYPIST":"PLUMHEAD","DIRECTOR":"WERTHER"} {"BANCROFT":"SALESMAN","MERCHANT":"SALESMAN","SHRINKY":"ADMINISTRATOR","WALTER":"ENGINEER","TONGHO":"ENGINEER","HONEY":"SECRETARY","PLUMHEAD":"TYPIST","WERTHER":"DIRECTOR","WHEELFOR":"SALESMAN"}
# #
# Test value getting UDF's # Test value getting UDF's
# #
......
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