# Issues with lua udfs in calling map module

**URL:** <https://discuss.aerospike.com/t/issues-with-lua-udfs-in-calling-map-module/3062>\
**Category:** General Discussion\
**Tags:** udf\
**Created:** [June 13, 2016, 9:41am UTC](https://discuss.aerospike.com/t/issues-with-lua-udfs-in-calling-map-module/3062 "2016-06-13T09:41:08Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![harshita23sharma](https://avatars.discourse-cdn.com/v4/letter/h/e47c2d/32.png) [@harshita23sharma](https://discuss.aerospike.com/u/harshita23sharma)\
**Post date:** [June 13, 2016, 9:41am UTC](https://discuss.aerospike.com/t/issues-with-lua-udfs-in-calling-map-module/3062/1 "2016-06-13T09:41:08Z")

</div>

I am using Ruby client and facing issues with map modules in aerospike which always return nil value.

I am referring to the documentation [map | Developer](http://www.aerospike.com/docs/udf/api/map.html) local m=map() aerospike attempt to call global ‘map’ (a nil value). Same is the issue with list,llist etc

Also,I tried using different clients but the issue remains same.

When tried calling map,i get this response

> local m=map() stdin:1: attempt to call global ‘map’ (a nil value) stack traceback: stdin:1: in main chunk [C]: in ?

The issue is clearly with Aerospike extensions to Lua.I want to know where I m getting wrong?

---

<div class="post-metadata">

**Author:** ![raj](https://avatars.discourse-cdn.com/v4/letter/r/c0e974/32.png) [@raj](https://discuss.aerospike.com/u/raj)\
**Post date:** [June 13, 2016, 10:02am UTC](https://discuss.aerospike.com/t/issues-with-lua-udfs-in-calling-map-module/3062/2 "2016-06-13T10:02:46Z")

</div>

Harshita,

Are you running normal record UDF or Aggregations. Which version of the server are you using and on which platform.

Can you try executing this UDF from aql. This is to eliminate client as cause.

```
aql > execute <udfname>.<function>(<params>) on <ns>.<set> where PK=<pk>

```

– Raj

---

<div class="post-metadata">

**Author:** ![harshita23sharma](https://avatars.discourse-cdn.com/v4/letter/h/e47c2d/32.png) [@harshita23sharma](https://discuss.aerospike.com/u/harshita23sharma)\
**Post date:** [June 13, 2016, 10:28am UTC](https://discuss.aerospike.com/t/issues-with-lua-udfs-in-calling-map-module/3062/3 "2016-06-13T10:28:16Z")

</div>

@rajversion : Aerospike Community Edition build 3.8.2.3 platform : Ubuntu 15.10

I just want to run record udfs.I tried using aql too but it is also not returning anything.

Thanks!

---

<div class="post-metadata">

**Author:** ![raj](https://avatars.discourse-cdn.com/v4/letter/r/c0e974/32.png) [@raj](https://discuss.aerospike.com/u/raj)\
**Post date:** [June 13, 2016, 11:23am UTC](https://discuss.aerospike.com/t/issues-with-lua-udfs-in-calling-map-module/3062/4 "2016-06-13T11:23:25Z")

</div>

> [@harshita23sharma](#):
>
> I just want to run record udfs.I tried using aql too but it is also not returning anything.

Will it be possilbe to share the lua code.

– R

---

<div class="post-metadata">

**Author:** ![harshita23sharma](https://avatars.discourse-cdn.com/v4/letter/h/e47c2d/32.png) [@harshita23sharma](https://discuss.aerospike.com/u/harshita23sharma)\
**Post date:** [June 13, 2016, 12:15pm UTC](https://discuss.aerospike.com/t/issues-with-lua-udfs-in-calling-map-module/3062/5 "2016-06-13T12:15:10Z")

</div>

@raj

It turned out that the problem was in my udf code only. I tried running the below udf and now it is working fine.

function readBin(r, name) local function mapper(rec) local element = map() element[name] = rec[name]; return element end return mapper(r) end

Thanks!

Still I have a query.

As ruby client doesn’t support aggregation,is there any way I can use Ruby client to find all activities of a subscriber\_key in descending order of timestamp\_key where my PK=combination of ( activity\_key,timestamp\_key) ?

---

<div class="post-metadata">

**Author:** ![Jan](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.aerospike.com/jan/32/1124_2.png) [@Jan](https://discuss.aerospike.com/u/Jan)\
**Post date:** [June 16, 2016, 9:31pm UTC](https://discuss.aerospike.com/t/issues-with-lua-udfs-in-calling-map-module/3062/6 "2016-06-16T21:31:14Z")

</div>

@harshita23sharma,

Since the Ruby client currently does not support aggregations, you’ll need to scan the whole set and handle the aggregation logic within your application. You can limit the scan to only return the subscriber\_key for each record to minimize data transfer. Also, to ensure you receive the full PK and not just the key hash in the scan results you need to ensure `send_key` is set to `true` in the write policy, when the records get created. With the Ruby client, this is the default.
