Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

get_range with :start_key not working as expected #127

Closed
Simbul opened this Issue · 0 comments

2 participants

@Simbul

I just stumbled into a weird get_range behaviour. Suppose we have a call such as:

cassandra.get_range(:CF, :start_key => "somekey", :key_count => 1)

What i would expect to get as a result is a structure with a single row with key "somekey" (regardless of the partitioner used).
Assuming that is the desired behaviour for get_range, something needs a fix, as you can see by running the following test (just drop it in test/cassandra_test.rb):

def test_get_one_key_with_start
  hash = {"name" => "value"}
  @twitter.insert(:Statuses, "a-key", hash)
  @twitter.insert(:Statuses, "b-key", hash)
  @twitter.insert(:Statuses, "c-key", hash)

  results = @twitter.get_range(:Statuses, :start_key => "b-key", :key_count => 1)
  assert_equal ["b-key"], results.keys
end

The test will return a failure with message:

<["b-key"]> expected but was
<["a-key"]>.

From a quick peek inside cassandra.rb, looks like the :start_key option is somehow discarded on line 758.

@rwjblue rwjblue closed this in d278a0d
@rwjblue rwjblue referenced this issue from a commit in rwjblue/cassandra
Robert Jackson Fix regression from #127. Resolves #129. 2d8989c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.