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

JD Maturen jdmaturen at
Tue Oct 12 01:14:10 EDT 2010

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'answers', 'account:%010d' %
>>> [l.get_key() for l in'answers', 'account:%d' %
>>> [l.get_key() for l in'answers', 'account:%020d' %

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'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' %
<riak.riak_object.RiakObject object at 0x10064e550>
>>> client.bucket('questions').new('2**32', {'account': '%020d' %
<riak.riak_object.RiakObject object at 0x1006510d0>
>>> [l.get_key() for l in'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'questions', 'account:%020d' %
>>> [l.get_key() for l in'questions', 'account:%020d' %

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the riak-users mailing list