diff options
| author | Wouter Bolsterlee <uws@xs4all.nl> | 2013-11-08 22:13:23 +0100 |
|---|---|---|
| committer | Wouter Bolsterlee <uws@xs4all.nl> | 2013-11-08 22:13:23 +0100 |
| commit | aea6980ea181912c0c8cdd61763bc5110c28a445 (patch) | |
| tree | 665fa7ab4d3e5f0a88577160f51da430cf29cba3 /tests/test_api.py | |
| parent | d972cabf1575dfbf83d518fb886c5f58c4c4a543 (diff) | |
| download | happybase-aea6980ea181912c0c8cdd61763bc5110c28a445.tar.gz | |
Add support for retrieving sorted columns in HBase >= 0.96
This is possible with the HBase 0.96 Thrift API. This feature uses a new
'sorted_columns' argument to Table.scan(). Fixes issue #39.
Diffstat (limited to 'tests/test_api.py')
| -rw-r--r-- | tests/test_api.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/test_api.py b/tests/test_api.py index bf6fda0..2d22717 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -14,6 +14,7 @@ from nose.tools import ( assert_in, assert_is_instance, assert_is_not_none, + assert_list_equal, assert_not_in, assert_raises, assert_true, @@ -427,6 +428,24 @@ def test_scan(): next(scanner) +def test_scan_sorting(): + if connection.compat < '0.96': + return # not supported + + input_row = {} + for i in xrange(100): + input_row['cf1:col-%03d' % i] = '' + input_key = 'row-scan-sorted' + table.put(input_key, input_row) + + scan = table.scan(row_start=input_key, sorted_columns=True) + key, row = next(scan) + assert_equal(key, input_key) + assert_list_equal( + sorted(input_row.items()), + row.items()) + + def test_delete(): row_key = 'row-test-delete' data = {'cf1:col1': 'v1', |
