Stream UDF error VAL TYPE UNDEFINED 7

Anyone have an idea what “VAL TYPE UNDEFINED 7” is? I have the most basic stream UDF.

function my_stream_udf(stream)
    return stream
end

I’m getting this error when I call aggregate on the client with the above stream UDF:

PANIC: unprotected error in call to Lua API (attempt to index a proto value)
Abort trap: 6

And in the log:

Mar 30 2015 20:53:47 GMT: DETAIL (query): (thr_query.c:as_query:2268) Query on index idx_loadtest4_source_id 
Mar 30 2015 20:53:47 GMT: DETAIL (query): (thr_query.c:as_query__queue:2143) Logged query 
Mar 30 2015 20:53:47 GMT: DETAIL (query): (thr_query.c:as_query__generator_get_nextbatch:1613) start 1 end 1 @ 1 pimd found 1
Mar 30 2015 20:53:47 GMT: DETAIL (query): (thr_query.c:as_query__generator_get_nextbatch:1636) All the Data finished moving to next tree 2
Mar 30 2015 20:53:47 GMT: DETAIL (query): (thr_query.c:as_query__generator:1782) Loop=1, Selected=1, ret=2
Mar 30 2015 20:53:47 GMT: DETAIL (query): (thr_query.c:as_query__process_request:1500) Processing Request 2
Mar 30 2015 20:53:47 GMT: DEBUG (query): (/opt/aerospike/usr/udf/lua/my_stream_udf.lua::2) my_stream_udf
Mar 30 2015 20:53:47 GMT: DETAIL (query): (thr_query.c:query_agg_istream_read:2689) Open Record (0x7fb2f7c39400,0 17450633933771699179, 140403552279552)
Mar 30 2015 20:53:47 GMT: DEBUG (udf): (udf_record.c:udf_record_open:200) [ENTER] Opening record key:<Digest>:0x4365e363c18c7f3218bf827df8e33dfc771397c4
Mar 30 2015 20:53:47 GMT: DEBUG (udf): (udf_record.c:udf_storage_record_open:82) [ENTER] Opening record key:<Digest>:0x4365e363c18c7f3218bf827df8e33dfc771397c4
Mar 30 2015 20:53:47 GMT: DETAIL (query): (thr_query.c:query_agg_istream_read:2712) Successfully read record
Mar 30 2015 20:53:47 GMT: DEBUG (udf): (udf_rw.c:as_val_tobuf:1288) SUCCESS: VAL TYPE UNDEFINED 7

Mar 30 2015 20:53:47 GMT: WARNING (proto): (thr_query.c::846) particle to buf: could not copy data!
Mar 30 2015 20:53:47 GMT: WARNING (udf): (udf_rw.c::1421) unmappable type 7
Mar 30 2015 20:53:47 GMT: DEBUG (udf): (udf_rw.c:as_val_tobuf:1288) SUCCESS: VAL TYPE UNDEFINED 7

Mar 30 2015 20:53:47 GMT: WARNING (proto): (proto.c::1121) particle to buf: could not copy data!
Mar 30 2015 20:53:47 GMT: DETAIL (query): (thr_query.c:query_agg_istream_read:2646) Close Record (0x7fb2f7c39400,0)
Mar 30 2015 20:53:47 GMT: DEBUG (udf): (udf_record.c:udf_record_close:261) [ENTER] Closing record key:<Digest>:0x4365e363c18c7f3218bf827df8e33dfc771397c4
Mar 30 2015 20:53:47 GMT: DEBUG (udf): (udf_record.c:udf_record_cache_free:440) [ENTER] NumUpdates(0) 
Mar 30 2015 20:53:47 GMT: DETAIL (query): (thr_query.c:query_agg_istream_read:2671) No More Nodes for this Lua Call
Mar 30 2015 20:53:47 GMT: DEBUG (query): (thr_query.c:as_query__agg:2870)  Apply Stream with my_stream_udf my_stream_udf 0x7fb23fdbdc80 0x7fb23fdbdc40 0x7fb23fdbdc60 ret=0
Mar 30 2015 20:53:47 GMT: DETAIL (query): (thr_query.c:as_query__generator:1823) All the Data finished; All tree finished 0 10
Mar 30 2015 20:53:47 GMT: DETAIL (query): (thr_query.c:as_qtr__release:802) Released qtr [base/thr_query.c:1837] 0x7fb2e9956608 0 
Mar 30 2015 20:53:47 GMT: DETAIL (query): (thr_query.c:as_qtr__release:804) Free qtr ref count is zero

Thanks for the help.

Aerospike does not support VAL TYPE record. You cannot return record from UDF directly. You need to copy into map to return.

– R

Thanks. How can I copy the stream into a map? My goal is to return an array of all records from the stream.