Aerospike support map with integer type key?


#1

I use Aerospike community 3.8.3, I found a wired behavior. The behavior is different between java client and AQL tool. I suppose Aerospike don’t support MAP with integer type key. for example as following, aql> INSERT INTO test.demo (PK , bar) VALUES (“key1”, MAP(’{1: 1, 2: 2}’) ) Error: (-1) Invalid MAP value: bar {1: 1, 2: 2} aql> INSERT INTO test.demo (PK , bar) VALUES (“key1”, MAP(’{“1”: 1, “2”: 2}’) ) OK, 1 record affected.

But when I use java client, set the value a HashMap with long type key, it works, and can query out by AQL, please check following ( please check the data field, the key is integer ! ) aql> select QKEY,time,data from test.StockSnapshot where QKEY between 6010201495762200 and 6010201495810800 ±-----------------±-----------±---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | QKEY | time | data | ±-----------------±-----------±---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | 6010201495778400 | 1495778400 | MAP(’{1495779705000000:08 02 10 02 1A 0B 58 53 48 47 5F 36 30 31 30 32 30 28 C0 A0 EA CF F5 8C D4 02 30 04 39 00 00 00 20 AE 07 34 40 41 9A 99 99 99 99 99 38 40 49 1F 85 EB 51 B8 1E 34 40 51 00 00 00 60 66 26 34 40 59 00 00 00 20 85 2B 34 40 61 00 00 00 | | 6010201495765800 | 1495765800 | MAP(’{1495768401000000:08 02 10 02 1A 0B 58 53 48 47 5F 36 30 31 30 32 30 28 C0 EC D4 C1 CB 8C D4 02 30 04 39 00 00 00 20 AE 07 34 40 41 9A 99 99 99 99 99 38 40 49 1F 85 EB 51 B8 1E 34 40 51 00 00 00 60 66 26 34 40 59 00 00 00 20 85 2B 34 40 61 00 00 00 | | 6010201495774800 | 1495774800 | MAP(’{1495776357000000:08 02 10 02 1A 0B 58 53 48 47 5F 36 30 31 30 32 30 28 C0 C6 B0 93 E9 8C D4 02 30 04 39 00 00 00 20 AE 07 34 40 41 9A 99 99 99 99 99 38 40 49 1F 85 EB 51 B8 1E 34 40 51 00 00 00 60 66 26 34 40 59 00 00 00 20 85 2B 34 40 61 00 00 00 | | 6010201495762200 | 1495762200 | MAP(’{1495764231000000:08 02 10 02 1A 0B 58 53 48 47 5F 36 30 31 30 32 30 28 C0 9F A0 FD BB 8C D4 02 30 04 39 00 00 00 20 AE 07 34 40 41 9A 99 99 99 99 99 38 40 49 1F 85 EB 51 B8 1E 34 40 51 00 00 00 60 66 26 34 40 59 00 00 00 20 85 2B 34 40 61 00 00 00 | ±-----------------±-----------±---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

What’s wrong ?


#2

If Java client can do it, this could be a AQL bug. Try with latest release. AQL is meant for quick, adhoc interaction with Aerospike, uses C Client underneath. Tokenizes and parses your string and converts to an C API call. Must be some error in parsing the map data. Map keys can be any scalar data type. http://www.aerospike.com/docs/guide/data-types.html#basic-types


#3

This is indeed a known short-coming of current aql, as it is using json/jansson for map input, which does not support integer as map key. This is logged as TOOLS-915 in our internal system.