I've created an aggregate function which works in aerospike which works in AQL:
AGGREGATE filter2.check_teamId('123', 0, 1456499994597) ON analytics.tracking
WHERE teamId = '123'
This returns results. I'm then trying 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 }
The server logs state:
Feb 28 2016 22:33:58 GMT: INFO (scan): (scan.c::933) starting aggregation scan job 1201452721893048027 {analytics:tracking} priority 2
Feb 28 2016 22:33:58 GMT: INFO (scan): (scan.c::1026) finished aggregation scan job 1201452721893048027 (0)
Does anyone have any tips for getting a UDF to work with NodeJS? Or any ideas how to diagnose the error?
I have set the user UDF 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