# Aerospike support map with integer type key?

**URL:** <https://discuss.aerospike.com/t/aerospike-support-map-with-integer-type-key/4196>\
**Category:** AQL\
**Created:** [May 27, 2017, 3:13am UTC](https://discuss.aerospike.com/t/aerospike-support-map-with-integer-type-key/4196 "2017-05-27T03:13:46Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![RockyTu](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.aerospike.com/rockytu/32/785_2.png) [@RockyTu](https://discuss.aerospike.com/u/RockyTu)\
**Post date:** [May 27, 2017, 3:13am UTC](https://discuss.aerospike.com/t/aerospike-support-map-with-integer-type-key/4196/1 "2017-05-27T03:13:46Z")

</div>

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 ?

---

<div class="post-metadata">

**Author:** ![pgupta](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.aerospike.com/pgupta/32/2351_2.png) [@pgupta](https://discuss.aerospike.com/u/pgupta)\
**Post date:** [May 27, 2017, 6:51am UTC](https://discuss.aerospike.com/t/aerospike-support-map-with-integer-type-key/4196/2 "2017-05-27T06:51:55Z")

</div>

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](http://www.aerospike.com/docs/guide/data-types.html#basic-types)

---

<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:** [May 30, 2017, 11:07pm UTC](https://discuss.aerospike.com/t/aerospike-support-map-with-integer-type-key/4196/3 "2017-05-30T23:07:15Z")

</div>

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.
