Attempt to call method 'filter' (a nil value)


#1

I found a warning in aerospike log as subject, does it mean it can’t find method filter?


#2

Yes, this is correct. Would you mind sharing your code so we can help and make sure there is nothing else unexpected happening?


#3
local function filter_clist(clist)
    return function(record)
        for idx=1, list.size(clist), 1 do
            if record.cawlEgId == clist[idx] then
                return true
            end
        end
        return false
    end
end
local function map_assign(record)
    return map{ skey=record.skey, cawlEgId=record.cawlEgId }
end
function multifilters(stream, start, stop)
    local my_filter = filter_clist(clist)
    return stream:filter(my_filter):map(map_assign)
end

#4

I used go cliant. Go codes:

exTask, err := client.ExecuteUDF(queryPolicy, stm, "state_udf", "multifilters", NewValue(clist))

#5

Thanks, let me check on this internally.


#6

StreamUDF is currently not support from the Go client, as it requires the last stage execution to be in Go. The client.ExecuteUDF() call invokes a RecordUDF context on the server side. As a result, the stream functions such as “filter” and “map” are not available in this context.


#7

Is this still true? does this also apply to the nodejs client? I am hitting the same issue here


#8

Node.js client is fully functional w/ StreamUDF.

If there is any separate issues seen with StreamUDF usage under Node.js, would recommend separate discuss item with details to diagnose.

Thanks.