Hi all,

Like to use UDF/UDA in c*-2.2 & above to aggregate attibutes values in a
json data.

For example below table.


*"CREATE  TABLE test ( id bigint , time1 bigint , jsonData text , PRIMARY
KEY(id,time1));*



*cqlsh:test> INSERT INTO test (id , time1 , jsonData ) VALUES ( 1, 123,
'{"node1":{"attr1":"91","attr2":"1","attr3":"333"},"node2":{"attr4":"1.01","attr5":"1.231","attr6":"1.12"}}');*


*cqlsh:test> INSERT INTO test (id , time1 , jsonData ) VALUES ( 2, 345,
'{"node1":{"attr1":"22","attr2":"4","attr3":"111"},"node2":{"attr4":"2.01","attr5":"3.231","attr6":"2.112"}}');*
*cqlsh:test> INSERT INTO test (id , time1 , jsonData ) VALUES ( 3, 333,
'{"node1":{"attr1":"17","attr2":"56","attr3":"167"},"node2":{"attr4":"1.11","attr5":"2.31","attr6":"3.112"}}');"*


Using UDF/UDA , I want attributes values of json data to be aggregated
something like below

*"select json_aggr(jsonData) from test; //SUM*

*{"node1":{"attr1":"130","attr2":"61","attr3":"611"},"node2":{"attr4":"4.13","attr5":"6.772","attr6":"6.344"}}"*

//130=91+22+17 etc.,


Can we do something like this , can we import java classes from thirdparty
jars for parsing/updating json in UDF defined? And how?
Can somebody please provide outline code for this?

Thanks,
Techpyaasa

Reply via email to