I would like to make a request in Aerospike similar than the following SQL query :
SELECT ts,inst,blob from db.table where inst = 'VALUE' and ts > 12234 and ts < 12245
bins are inserted according to this structure (in python):
{ ts : integer for a timestamp
inst : string
blob : bytearray }
I have a secondary index on “ts”. “blob” is a bytearray which is the result of a “zlib.compress” of a “json.dumps”.
As I understood, I need to create a LUA aggregation function. So here is the LUA code I wrote :
local function map_profile(record)
return map {ts=record.ts,inst=record.inst,blob=record.blob }
end
function check_instrument(stream,instrument)
local function filter_instrument(record)
return record.inst == instrument
end
return stream : filter(filter_instrument) : map(map_profile)
end
Then, I make the following AQL query :
aggregate profile.check_instrument('VALUE') on mynamespace.myset where ts between 12234 and 12245
which give me this response :
+-------------------------------------------+
| check_instr... |
+-------------------------------------------+
| {"inst":"VALUE", "ts":12235} |
| {"inst":"VALUE", "ts":12236} |
+-------------------------------------------+
where is my bytearray blob ? If a put a string in my blob instead of a bytearray, the query above give me this response :
+-------------------------------------------+
| check_instr... |
+----------------------------------------------------------+
| {"inst":"VALUE", "ts":12235, "blob" : "hello"} |
| {"inst":"VALUE", "ts":12236, "blob" : "hello"} |
+----------------------------------------------------------+
with the blob !
What I did not understand ? Could we get a bytearray with an aggregation in LUA ? How can I have my bytearray blob in response of an aggregation query ?
Thank you
aerospike-server-community 3.5.9-1 ubuntu