C Client does not support querying binary data

Postby gsanchez » Mon Jan 27, 2014 4:20 pm

I am using version 3.0.44 of the Aerospike C Client and it looks like the where clause in a query only allows NULL-terminated strings. The as_predicate_value structure only stores a pointer to a char * and the code uses strlen() to determine the length of such string. Is there any way of constructing a predicate that can contain NULL characters?

Postby young » Tue Jan 28, 2014 3:23 pm

This is correct, our strings are UTF-8, which do not support nulls. The only way to do this is to store it as a blob.

Re: C Client does not support querying binary data Postby gsanchez » Tue Jan 28, 2014 4:10 pm

I tried storing it as a blob and modified the client to support querying by blobs. I created a secondary string index on the blob bin and the server returns an error AEROSPIKE_ERR_INDEX. I checked the TCP segments in wireshark and the data is in fact there. Is it just that Aerospike doesn’t support querying blobs?

Postby young » Wed Jan 29, 2014 11:04 am

Sorry, this is correct, Aerospike currently only supports integer and string secondary indexes.

If you can describe your use case to us, we may be able to find a different way of accomplishing the same thing. What is it that you are trying to index?

Re: C Client does not support querying binary data Postby gsanchez » Wed Jan 29, 2014 12:00 pm

I was trying to index a 10-byte identity that can contain nulls. I ended up splitting it up into two integers. Thanks for the help!

Just wonder how do you index those two integers? Can I create two secondary indexes on two bins from one set?

Thanks!

One bin can have the integer value, and the second part can be using query_udf to filter data out based on the second bin.

Example: https://github.com/aerospike/query-with-filters