Lua udf reduce function seems not excuted

here is my lua udf script

function distance_to(src_lng, src_lat, des_lng, des_lat)
    xSide2 = (src_lat - des_lat) * (src_lat - des_lat);
    ySide2 = (src_lng - des_lng) * (src_lng - des_lng);
    return math.sqrt(xSide2 + ySide2);

function split(str, sep)
    local sep, fields = sep or "\t", {}
    local pattern = string.format("([^%s]+)", sep)
    str:gsub(pattern, function(c) fields[#fields+1] = c end)
    return fields

local function reduce_stats(a, b)
    local out = map()
    if (a["dis"] > b["dis"]) then
        out["dis"] = b["dis"]
        out["area"] = b["area"]
        out["dis"] = a["dis"]
        out["area"] = a["area"]
    return out

local function map_stat(out, rec)
    local src_lng = out['src_lng']
    local src_lat = out['src_lat']
    local nearest_dis = out['dis']
    local current_area_id = rec['areaid']
    local lbs_info = rec['lbs']
    local lbs_fields = split(lbs_info, 'x')
    local des_lng = tonumber(lbs_fields[1])
    local des_lat = tonumber(lbs_fields[2])
    local current_dis = distance_to(src_lng, src_lat, des_lng, des_lat)
    if ( nearest_dis > current_dis ) then
        out['dis'] = current_dis
        out['area'] = current_area_id
    return out

function geo_nearest(stream, lng, lat)
    return stream :
    aggregate(map{src_lng = lng, src_lat = lat, area = "", dis = 100}, map_stat) :

which returns a serial of values,not a single one.Is that reduce function didn’t execute on the client node?Need some addtion ops?

See How do I debug the 'reduce()' operation of a stream UDF? and track it all the way through.

tks,I have read this.Btw I’m trying to query geospatial information about nearest place to a given geospatial point using hadoop mapreduce program and async aerospike client api.But performance degrades to around 20TPS.Is there some best practise on geospatial query? thanks a lot.

Perhaps post that as a separate question with different topic - under ? - so folks doing geo-spatial may be able to comment.

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