Stream UDF failed with: attempt to call method 'map' (a nil value)

I’m testing udf on my aerospike server. My test udf code is:

function topn_item_stream_udf(s, topn)
        local function item_map_fn(record)
                local item = map {key=record["note_id"], value=record["index_hot_click"]/(record["index_hot_pv"]+1)}
                return item
        return stream : map(item_map_fn)

When I run command in aql like this:

execute topn_item.topn_item_stream_udf() on algo.note_stat_2

I got error:

result “run/work/usr/udf/lua/topn_item.lua:9: attempt to call method ‘map’ (a nil value)”

What’s the problem with my server or my code? Could someone give me some help? Thanks!

© 2015 Copyright Aerospike, Inc. | All rights reserved. Creators of the Aerospike Database.