I'm trying to output two values from a javascript udf, which takes a JSON
document as input.....but for the life of me I can't seem to get it to
return where I can reference the device_id or user_device......

I've tried this, which when I dump the data I just get noting => ()

get_device_id_and_type.outputSchema = "t:tuple(device_id:chararray,
user_device:chararray)";
function get_device_id_and_type(doc){
var obj = eval('(' + doc + ')');
return {device_id:obj.device_id , user_device:obj.user_device};
}

grunt> describe c;
c: {t: (device_id: chararray,user_device: chararray)}



this returns data, buy it's only one column.....

get_device_id_and_type.outputSchema = "device_id:chararray,
user_device:chararray";
function get_device_id_and_type(doc){
var obj = eval('(' + doc + ')');
return {device_id:obj.device_id , user_device:obj.user_device};
}

grunt> describe c;
c: {(device_id: chararray,user_device: chararray)}


Am I doing something wrong with my function decorators or with the return?
 or should I bag javascript and go to jython or jruby :)

Dan

Reply via email to