You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kudu.apache.org by to...@apache.org on 2016/09/28 04:28:38 UTC

[1/2] kudu git commit: KUDU-1637 - [python] Add Support for < and > Predicates

Repository: kudu
Updated Branches:
  refs/heads/master a03a2f380 -> 1c4dcabdd


KUDU-1637 - [python] Add Support for < and > Predicates

Currently the python client doesn't support < and > predicates.
This patch adds that support and includes changes to existing tests.

Change-Id: Ic78dcf58949277fc8363d4d5b3bfa6067932a823
Reviewed-on: http://gerrit.cloudera.org:8080/4524
Tested-by: Kudu Jenkins
Reviewed-by: David Ribeiro Alves <dr...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/01bf011c
Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/01bf011c
Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/01bf011c

Branch: refs/heads/master
Commit: 01bf011cd49e132a8333bf8ea7272b8354e8cab2
Parents: a03a2f3
Author: Jordan Birdsell <jo...@gmail.com>
Authored: Thu Sep 22 22:18:06 2016 -0500
Committer: Todd Lipcon <to...@apache.org>
Committed: Wed Sep 28 04:26:08 2016 +0000

----------------------------------------------------------------------
 python/kudu/client.pyx              | 6 +++++-
 python/kudu/libkudu_client.pxd      | 2 ++
 python/kudu/tests/test_scanner.py   | 2 +-
 python/kudu/tests/test_scantoken.py | 2 +-
 4 files changed, 9 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/01bf011c/python/kudu/client.pyx
----------------------------------------------------------------------
diff --git a/python/kudu/client.pyx b/python/kudu/client.pyx
index 800a620..bd37d2b 100644
--- a/python/kudu/client.pyx
+++ b/python/kudu/client.pyx
@@ -768,10 +768,14 @@ cdef class Column:
                                    len(self.name))
 
         try:
-            if op == 1: # <=
+            if op == 0: # <
+                cmp_op = KUDU_LESS
+            elif op == 1: # <=
                 cmp_op = KUDU_LESS_EQUAL
             elif op == 2: # ==
                 cmp_op = KUDU_EQUAL
+            elif op == 4: # >
+                cmp_op = KUDU_GREATER
             elif op == 5: # >=
                 cmp_op = KUDU_GREATER_EQUAL
             else:

http://git-wip-us.apache.org/repos/asf/kudu/blob/01bf011c/python/kudu/libkudu_client.pxd
----------------------------------------------------------------------
diff --git a/python/kudu/libkudu_client.pxd b/python/kudu/libkudu_client.pxd
index 11bc78d..091f326 100644
--- a/python/kudu/libkudu_client.pxd
+++ b/python/kudu/libkudu_client.pxd
@@ -423,6 +423,8 @@ cdef extern from "kudu/client/scan_predicate.h" namespace "kudu::client" nogil:
         KUDU_LESS_EQUAL    " kudu::client::KuduPredicate::LESS_EQUAL"
         KUDU_GREATER_EQUAL " kudu::client::KuduPredicate::GREATER_EQUAL"
         KUDU_EQUAL         " kudu::client::KuduPredicate::EQUAL"
+        KUDU_LESS          " kudu::client::KuduPredicate::LESS"
+        KUDU_GREATER       " kudu::client::KuduPredicate::GREATER"
 
     cdef cppclass KuduPredicate:
         KuduPredicate* Clone()

http://git-wip-us.apache.org/repos/asf/kudu/blob/01bf011c/python/kudu/tests/test_scanner.py
----------------------------------------------------------------------
diff --git a/python/kudu/tests/test_scanner.py b/python/kudu/tests/test_scanner.py
index 3cfe80e..b1d8505 100644
--- a/python/kudu/tests/test_scanner.py
+++ b/python/kudu/tests/test_scanner.py
@@ -43,7 +43,7 @@ class TestScanner(TestScanBase):
 
     def test_scan_rows_simple_predicate(self):
         key = self.table['key']
-        preds = [key >= 20, key <= 49]
+        preds = [key > 19, key < 50]
 
         def _read_predicates(preds):
             scanner = self.table.scanner()

http://git-wip-us.apache.org/repos/asf/kudu/blob/01bf011c/python/kudu/tests/test_scantoken.py
----------------------------------------------------------------------
diff --git a/python/kudu/tests/test_scantoken.py b/python/kudu/tests/test_scantoken.py
index 415c949..d3aff74 100644
--- a/python/kudu/tests/test_scantoken.py
+++ b/python/kudu/tests/test_scantoken.py
@@ -76,7 +76,7 @@ class TestScanToken(TestScanBase):
         them in parallel with seperate clients.
         """
         key = self.table['key']
-        preds = [key >= 20, key <= 49]
+        preds = [key > 19, key < 50]
 
         builder = self.table.scan_token_builder()
         builder.set_projected_column_indexes([0, 1])\


[2/2] kudu git commit: KUDU-1653 - [python] Python 3 Failing to Deserialize Token

Posted by to...@apache.org.
KUDU-1653 - [python] Python 3 Failing to Deserialize Token

Python 3 is failing to deserialize tokens because it is forcing it
to decode in UTF-8.  The serialized tokens should be left as byte
strings to avoid this issue. This patch is tested by existing tests.

Change-Id: I1969d67fa75db28626e0d4e130f1d68a5fd3b1d5
Reviewed-on: http://gerrit.cloudera.org:8080/4542
Tested-by: Kudu Jenkins
Reviewed-by: Todd Lipcon <to...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/1c4dcabd
Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/1c4dcabd
Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/1c4dcabd

Branch: refs/heads/master
Commit: 1c4dcabddc1188e0881d6b35141cee1ec7171e7b
Parents: 01bf011
Author: Jordan Birdsell <jo...@gmail.com>
Authored: Tue Sep 27 08:11:28 2016 -0400
Committer: Todd Lipcon <to...@apache.org>
Committed: Wed Sep 28 04:26:42 2016 +0000

----------------------------------------------------------------------
 python/kudu/client.pyx | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/1c4dcabd/python/kudu/client.pyx
----------------------------------------------------------------------
diff --git a/python/kudu/client.pyx b/python/kudu/client.pyx
index bd37d2b..ebe2ff5 100644
--- a/python/kudu/client.pyx
+++ b/python/kudu/client.pyx
@@ -1407,7 +1407,7 @@ cdef class ScanToken:
         """
         cdef string buf
         check_status(self._token.Serialize(&buf))
-        return frombytes(buf)
+        return buf
 
     def deserialize_into_scanner(self, Client client, serialized_token):
         """
@@ -1426,7 +1426,7 @@ cdef class ScanToken:
         cdef:
             Scanner result = Scanner()
             KuduScanner* _scanner
-        check_status(self._token.DeserializeIntoScanner(client.cp, tobytes(serialized_token), &_scanner))
+        check_status(self._token.DeserializeIntoScanner(client.cp, serialized_token, &_scanner))
         result.scanner = _scanner
         return result