Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

long is not sufficient for 2i integer indices #402

Closed
pallinger opened this issue Mar 27, 2014 · 3 comments · Fixed by #404
Closed

long is not sufficient for 2i integer indices #402

pallinger opened this issue Mar 27, 2014 · 3 comments · Fixed by #404

Comments

@pallinger
Copy link

The riak interface for integer 2i does not specify an upper limit for possible index values (and I tested it with 2^1024 and it works for both exact and range queries), so having a long in the API is not sufficient.
There should be an arbitrary-precision integer used, if possible. I realise this results in an API change, but as 2.0 is not final yet, this may be bearable.

Corresponding tickets:
basho-labs/riak-data-migrator#11 (where I located the problem)
#112 (where you switched from int to long)

@pallinger pallinger changed the title long is not sufficient for 2i integer indexes long is not sufficient for 2i integer indices Mar 27, 2014
@broach
Copy link
Contributor

broach commented Mar 27, 2014

Using long in the Java client user API for _int indexes was a design decision made when the change you note occurred. It is simply the most common use case and easier for most people to understand and use.

That said, the new Java client does not have this restriction. We only emphasize using long as, again, that's what most users are going to do.

If you look at the query builder in core you'll note that the parameters are all BinaryValue regardless of whether the index is an _int or _bin in Riak. The javadoc there explicitly mentions what that should be for _int indexes.

On the object side, RawIndex is provided for working directly with those bytes, and the @RiakIndex annotation now supports byte[] as well.

I just looked at the user-level API FetchIndex that sits on top of core and it actually needs some correction, but byte[] will be exposed.

@broach broach closed this as completed Mar 27, 2014
@pallinger
Copy link
Author

good news, thanks!

@broach
Copy link
Contributor

broach commented Mar 29, 2014

I was actually working with this code and figured ... why not support it directly. It wasn't more than 30 mins of work.

@broach broach reopened this Mar 29, 2014
broach pushed a commit that referenced this issue Mar 29, 2014
Since I was working with this code, it was an easy addition to provide
BigInteger support.

This commit adds BigInteger support to the @RiakIndex annotation and
to the user and core API.

Resolves #402
@broach broach added this to the 2.0.0-Beta2 milestone Mar 29, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants