Skip to content

Commit

Permalink
Correctly pack slice ends for xget()
Browse files Browse the repository at this point in the history
  • Loading branch information
thobbs committed Aug 19, 2012
1 parent 2dd02da commit 65af172
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
8 changes: 6 additions & 2 deletions pycassa/columnfamily.py
Original file line number Diff line number Diff line change
Expand Up @@ -533,9 +533,13 @@ def xget(self, key, column_start="", column_finish="", column_reversed=False,
count = i = 0
last_name = finish = ""
if column_start != "":
last_name = self._pack_name(column_start)
last_name = self._pack_name(column_start,
is_supercol_name=self.super,
slice_start=(not column_reversed))
if column_finish != "":
finish = self._pack_name(column_finish)
finish = self._pack_name(column_finish,
is_supercol_name=self.super,
slice_start=column_reversed)

while True:
if column_count is not None:
Expand Down
12 changes: 12 additions & 0 deletions tests/test_autopacking.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,18 @@ def test_standard_column_family(self):

# Test xget paging
assert_equal(list(cf.xget(KEYS[0], buffer_size=2)), gdict.items())
assert_equal(list(cf.xget(KEYS[0], column_reversed=True, buffer_size=2)),
list(reversed(gdict.items())))
assert_equal(list(cf.xget(KEYS[0], column_start=gcols[0], buffer_size=2)),
gdict.items())
assert_equal(list(cf.xget(KEYS[0], column_finish=gcols[2], buffer_size=2)),
gdict.items())
assert_equal(list(cf.xget(KEYS[0], column_start=gcols[2], column_finish=gcols[0],
column_reversed=True, buffer_size=2)),
list(reversed(gdict.items())))
assert_equal(list(cf.xget(KEYS[0], column_start=gcols[1], column_finish=gcols[1],
column_reversed=True, buffer_size=2)),
[(gcols[1], VALS[1])])

# Test removing rows
cf.remove(KEYS[0], columns=gcols[:1])
Expand Down

0 comments on commit 65af172

Please sign in to comment.