get_range with :start_key not working as expected #127

Simbul opened this Issue Nov 8, 2011 · 0 comments


None yet
2 participants

Simbul commented Nov 8, 2011

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

The test will return a failure with message:

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

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

rwjblue closed this in d278a0d Nov 8, 2011

@rwjblue rwjblue pushed a commit to rwjblue/cassandra that referenced this issue Nov 15, 2011

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