Non-default padding on integer type not working. And only integer type only works with signed 32-bit ints?

Rusty Klophaus rusty at basho.com
Mon Oct 18 11:54:58 EDT 2010


Hi JD,

Unfortunately we discovered some last minute regression bugs that affect
integer querying. A workaround, as you discovered, is to pad the integers
yourself.

This is tracked as https://issues.basho.com/show_bug.cgi?id=729, and is
currently scheduled for the next release.

Best,
Rusty

On Tue, Oct 12, 2010 at 1:14 AM, JD Maturen <jdmaturen at gmail.com> wrote:

> I set a custom schema with a 20 digit (~64-bit) integer field:
>
> {field, [
> {name, "account"},
>  {type, integer},
> {padding_size, 20}
> ]},
>
> But I can only query with a 10 digit padded string:
>
> >>> [l.get_key() for l in client.search('answers', 'account:%010d' %
> (12345678)).run()]
> [u'test']
> >>> [l.get_key() for l in client.search('answers', 'account:%d' %
> (12345678)).run()]
> []
> >>> [l.get_key() for l in client.search('answers', 'account:%020d' %
> (12345678)).run()]
> []
>
> Additionally, I can't search for any ints larger than signed 32-bit.
>
> >>> client.bucket('answers').new('2**31', {'account': 2**31}).store()
> <riak.riak_object.RiakObject object at 0x10064ee90>
> >>> client.bucket('answers').new('2**31-1', {'account': 2**31-1}).store()
> <riak.riak_object.RiakObject object at 0x10064e550>
> >>> [l.get_key() for l in client.search('answers', 'account:{%010d TO
> %010d}' % (0, 2**33)).run()]
> [u'test', u'2%2A%2A31-1']
>
> General work-around seems to be to just use the string type and manage
> padding on my own [example on a bucket with the default schema]:
>
> >>> client.bucket('questions').new('2**64', {'account': '%020d' %
> 2**64}).store()
> <riak.riak_object.RiakObject object at 0x10064e550>
> >>> client.bucket('questions').new('2**32', {'account': '%020d' %
> 2**32}).store()
> <riak.riak_object.RiakObject object at 0x1006510d0>
> >>> [l.get_key() for l in client.search('questions', 'account:{%020d TO
> %020d}' % (2**32-1, 2**64+1)).run()]
> [u'2%2A%2A64', u'2%2A%2A32']
> >>> [l.get_key() for l in client.search('questions', 'account:%020d' %
> 2**64).run()]
> [u'2%2A%2A64']
> >>> [l.get_key() for l in client.search('questions', 'account:%020d' %
> 2**32).run()]
> [u'2%2A%2A32']
>
> -JD
>
> _______________________________________________
> riak-users mailing list
> riak-users at lists.basho.com
> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.basho.com/pipermail/riak-users_lists.basho.com/attachments/20101018/3f92e818/attachment.html>


More information about the riak-users mailing list