# Zero-length digest in UDF

**URL:** <https://discuss.aerospike.com/t/zero-length-digest-in-udf/527>\
**Category:** General Discussion\
**Created:** [November 20, 2014, 5:14am UTC](https://discuss.aerospike.com/t/zero-length-digest-in-udf/527 "2014-11-20T05:14:50Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![kenn](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.aerospike.com/kenn/32/95_2.png) [@kenn](https://discuss.aerospike.com/u/kenn)\
**Post date:** [November 20, 2014, 5:14am UTC](https://discuss.aerospike.com/t/zero-length-digest-in-udf/527/1 "2014-11-20T05:14:51Z")

</div>

I use a normal filter to run a search on a secondary index and then pass the results through a UDF to do additional filtering. In my main function I execute the function like so:

```
return stream : filter(create_filter_params(filters)) : map(map_record_passthru)

```

where `create_filter_params` creates a function to do the additional filtering, returning a boolean. This function works and the correct records are being returned. `map_record_passthru` is a utility function to convert the `Record` objects to `Map` objects so they can be returned back to my Java client. I had to implement this as Aerospike wouldn’t let me returns the records themselves.

```
function map_record_passthru(rec)
  local m = map()
  m._digest = tostring(record.digest(rec))
  m._gen = record.gen(rec)
  m._ttl = record.ttl(rec)
  local names = record.bin_names(rec)
  for i, name in ipairs(names) do
    m[name] = rec[name]
  end
  return m
end

```

**The problem** is that when this map is returned to the client, `_gen` is 1 (which seems odd), `_ttl` is 0 (correct), and `_digest` is `nil`. I’ve tried reading the result of `record.digest` in various other ways and the most I’ve been able to determine is that it’s a zero-length `Bytes` value.

How do I get the digest of a record in this way? Am I solving the problem wrong? Is there another way of getting the primary key of a record? My end goal is to store the primary key as a reference.

---

<div class="post-metadata">

**Author:** ![brad](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.aerospike.com/brad/32/2566_2.png) [@brad](https://discuss.aerospike.com/u/brad)\
**Post date:** [November 26, 2014, 3:55am UTC](https://discuss.aerospike.com/t/zero-length-digest-in-udf/527/2 "2014-11-26T03:55:15Z")

</div>

Using record.digest() is correct, and I’m trying to reproduce the problem you are seeing. What OS and server version are you using?

---

<div class="post-metadata">

**Author:** ![kenn](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.aerospike.com/kenn/32/95_2.png) [@kenn](https://discuss.aerospike.com/u/kenn)\
**Post date:** [November 27, 2014, 3:06am UTC](https://discuss.aerospike.com/t/zero-length-digest-in-udf/527/3 "2014-11-27T03:06:44Z")

</div>

I’m currently running Aerospike Community Edition build 3.3.19 on Ubuntu 14.04.1 LTS.

---

<div class="post-metadata">

**Author:** ![wchu](https://avatars.discourse-cdn.com/v4/letter/w/a5b964/32.png) [@wchu](https://discuss.aerospike.com/u/wchu)\
**Post date:** [December 26, 2014, 6:55am UTC](https://discuss.aerospike.com/t/zero-length-digest-in-udf/527/4 "2014-12-26T06:55:51Z")

</div>

We’ve diagnosed the issue and will be putting out a fix soon. Thanks!

---

<div class="post-metadata">

**Author:** ![Mnemaudsyne](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.aerospike.com/mnemaudsyne/32/200_2.png) [@Mnemaudsyne](https://discuss.aerospike.com/u/Mnemaudsyne)\
**Post date:** [April 8, 2015, 4:13pm UTC](https://discuss.aerospike.com/t/zero-length-digest-in-udf/527/5 "2015-04-08T16:13:44Z")

</div>

Hi!

Just to close the loop, we released a fix for this issue in our [Server Release 3.4.1](http://www.aerospike.com/download/server/notes.html#3.4.1) (January 12, 2015). But you will want to [upgrade to our latest Server Release, 3.5.4](http://www.aerospike.com/download/server), which was released on March 10, 2015.

Best regards,

Maud
