I created an aggregate function that works in an aerosystem that works in AQL:
AGGREGATE filter2.check_teamId('123', 0, 1456499994597) ON analytics.tracking WHERE teamId = '123'
This returns the results. Then I try to use the same UDF in NodeJS:
var statement = { aggregationUDF: {module: 'filter2', funcname: 'check_teamId', arg:['123', 0, 1456499994597]} }; var query = client.query('analytics', 'tracking', statement); var stream = query.execute();
The result is a seemingly uninformative error:
{ code: 100, message: 'UDF: Execution Error 1', func: 'as_query_aggregate', file: 'src/main/aerospike/aerospike_query.c', line: 903 }
Server Log Status:
February 28, 2016 22:33:58 GMT: INFO (scan): (scan.c :: 933), starting the aggregation task 1201452721893048027 {analytics: tracking} priority 2
February 28, 2016 22:33:58 GMT: INFO (scan): (scan.c :: 1026) completed aggregation scan job 1201452721893048027 (0)
Does anyone have any tips on getting UDF to work with NodeJS? Or any ideas how to diagnose a bug?
I set the UDF user location in the config, which does not affect the result.
UPDATE: Here is the lua code:
local function map_profile(record) return map {interaction=record.interaction, teamId=record.teamId, datetime=record.datetime, timestamp=record.timestamp, version=record.version, interactions=record.interactions} end function check_teamId(stream, teamId, startDate, endDate) local function filter_teamId(record) return record.teamId == teamId and record.timestamp >= startDate and record.timestamp <= endDate end return stream : filter(filter_teamId) : map(map_profile) end