Can’t figure out what’s happening here and log file isn’t indicating anything useful.
Error:
scanAggregate Error: { code: 100, message: 'UDF: Execution Error 1', func: 'aerospike_query_foreach', file: 'src/main/aerospike/aerospike_query.c', line: 808 }
On my end using node.js as client. UDF file is:
local function starts_with(map,rec)
if tostring(rec.tweet):find('%a+') ~= nil then
map['tweets'] = map['tweets'] .. ',' .. tostring(rec.tweet)
end
return map
end
local function reduce_stats(a,b)
a.tweets = a.tweets .. b.tweets
return a
end
function find(stream,chars)
return stream : aggregate(map{tweets='',chars=chars},starts_with) : reduce(reduce_stats)
end
Node.js code:
var statement = {aggregationUDF: {module: 'findtweet', funcname: 'find', args: ['please']}};
var query = client.query('test', 'tweets', statement);
var stream = query.execute();
stream.on('data', function(result) {
var tweets = result.tweets.split(",").filter(function(e){return e});
console.log('Tweets: ', tweets);
console.log('Count: ', tweets.length);
});
stream.on('error', function(err) {
console.log('scanAggregate Error: ',err);
});
And udf.log file contains many lines of the same thing which look like this:
Jun 11 2015 06:25:56 GMT: DEBUG (udf): (udf_record.c:udf_record_cache_free:448) [ENTER] NumUpdates(1)
Jun 11 2015 06:25:56 GMT: DEBUG (udf): (udf_record.c:udf_record_open:205) [ENTER] Opening record key:<Digest>:0xfd8fe98439939a0ecb4933f7994f69b84a9f20c0
Jun 11 2015 06:25:56 GMT: DEBUG (udf): (udf_record.c:udf_storage_record_open:83) [ENTER] Opening record key:<Digest>:0xfd8fe98439939a0ecb4933f7994f69b84a9f20c0
Jun 11 2015 06:25:56 GMT: DEBUG (udf): (udf_record.c:udf_record_get:687) [ENTER] rec(0x7f75acbb7280) name(tweet)
Jun 11 2015 06:25:56 GMT: DEBUG (udf): (udf_record.c:udf_record_cache_get:424) [ENTER] BinName(tweet)
Jun 11 2015 06:25:56 GMT: DEBUG (udf): (udf_record.c:udf_record_cache_set:481) [ENTER] urecord(0x7f75acbb7940) name(0x40f61938)[tweet] dirty(0)
Jun 11 2015 06:25:56 GMT: DEBUG (udf): (udf_record.c:udf_record_get:687) [ENTER] rec(0x7f75acbb7280) name(tweet)
Jun 11 2015 06:25:56 GMT: DEBUG (udf): (udf_record.c:udf_record_cache_get:424) [ENTER] BinName(tweet)
Jun 11 2015 06:25:56 GMT: DEBUG (udf): (udf_record.c:udf_record_close:266) [ENTER] Closing record key:<Digest>:0xfd8fe98439939a0ecb4933f7994f69b84a9f20c0
Jun 11 2015 06:25:56 GMT: DEBUG (udf): (udf_record.c:udf_record_cache_free:448) [ENTER] NumUpdates(1)
Any ideas on whats going on here? I’ve simplified UDF file to just find any tweets that matches any word. Doesn’t matter what I search the end result is that error.
Have tried playing with the example provided here
I am using test data from the online course.