Repository: kudu
Updated Branches:
  refs/heads/master 1961305d8 -> dd49515f3


[java-client] address follow-up comments to c7dab4

Change-Id: Id9c071b8c267ed86f74c6d13b49d4c4693fddc94
Reviewed-on: http://gerrit.cloudera.org:8080/4442
Reviewed-by: Jean-Daniel Cryans <jdcry...@apache.org>
Tested-by: Kudu Jenkins


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

Branch: refs/heads/master
Commit: dd49515f38da49e2fb8670a23d5485b27c0200b1
Parents: 1961305
Author: Dan Burkert <d...@cloudera.com>
Authored: Fri Sep 16 12:59:21 2016 -0700
Committer: Dan Burkert <d...@cloudera.com>
Committed: Fri Sep 16 21:05:54 2016 +0000

----------------------------------------------------------------------
 .../org/apache/kudu/client/AbstractKuduScannerBuilder.java     | 2 --
 .../src/main/java/org/apache/kudu/client/KeyEncoder.java       | 6 ++----
 .../src/main/java/org/apache/kudu/client/PartitionPruner.java  | 3 ++-
 .../src/main/java/org/apache/kudu/util/ByteVec.java            | 6 +++---
 .../src/test/java/org/apache/kudu/util/TestByteVec.java        | 6 +++---
 5 files changed, 10 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/dd49515f/java/kudu-client/src/main/java/org/apache/kudu/client/AbstractKuduScannerBuilder.java
----------------------------------------------------------------------
diff --git 
a/java/kudu-client/src/main/java/org/apache/kudu/client/AbstractKuduScannerBuilder.java
 
b/java/kudu-client/src/main/java/org/apache/kudu/client/AbstractKuduScannerBuilder.java
index 17bc66d..54753dd 100644
--- 
a/java/kudu-client/src/main/java/org/apache/kudu/client/AbstractKuduScannerBuilder.java
+++ 
b/java/kudu-client/src/main/java/org/apache/kudu/client/AbstractKuduScannerBuilder.java
@@ -308,7 +308,6 @@ public abstract class AbstractKuduScannerBuilder
 
   /**
    * Set an encoded (inclusive) start partition key for the scan.
-   * Not for public consumption: use either predicates or primary key bounds 
instead.
    *
    * @param partitionKey the encoded partition key
    * @return this instance
@@ -322,7 +321,6 @@ public abstract class AbstractKuduScannerBuilder
 
   /**
    * Set an encoded (exclusive) end partition key for the scan.
-   * Not for public consumption: use either predicates or primary key bounds 
instead.
    *
    * @param partitionKey the encoded partition key
    * @return this instance

http://git-wip-us.apache.org/repos/asf/kudu/blob/dd49515f/java/kudu-client/src/main/java/org/apache/kudu/client/KeyEncoder.java
----------------------------------------------------------------------
diff --git 
a/java/kudu-client/src/main/java/org/apache/kudu/client/KeyEncoder.java 
b/java/kudu-client/src/main/java/org/apache/kudu/client/KeyEncoder.java
index 10e4355..6305d0d 100644
--- a/java/kudu-client/src/main/java/org/apache/kudu/client/KeyEncoder.java
+++ b/java/kudu-client/src/main/java/org/apache/kudu/client/KeyEncoder.java
@@ -194,10 +194,8 @@ class KeyEncoder {
     byte lastByte = value[offset + (len - 1)];
     lastByte = Bytes.xorLeftMostBit(lastByte);
     buf.push(lastByte);
-    if (len > 1) {
-      for (int i = len - 2; i >= 0; i--) {
-        buf.push(value[offset + i]);
-      }
+    for (int i = len - 2; i >= 0; i--) {
+      buf.push(value[offset + i]);
     }
   }
 

http://git-wip-us.apache.org/repos/asf/kudu/blob/dd49515f/java/kudu-client/src/main/java/org/apache/kudu/client/PartitionPruner.java
----------------------------------------------------------------------
diff --git 
a/java/kudu-client/src/main/java/org/apache/kudu/client/PartitionPruner.java 
b/java/kudu-client/src/main/java/org/apache/kudu/client/PartitionPruner.java
index 4545767..2ab5adf 100644
--- a/java/kudu-client/src/main/java/org/apache/kudu/client/PartitionPruner.java
+++ b/java/kudu-client/src/main/java/org/apache/kudu/client/PartitionPruner.java
@@ -168,7 +168,8 @@ public class PartitionPruner {
     // The index of the final constrained component in the partition key.
     int constrainedIndex = 0;
     if (rangeLowerBound.length > 0 || rangeUpperBound.length > 0) {
-      // The range component is constrained.
+      // The range component is constrained if either of the range bounds are
+      // specified (non-empty).
       constrainedIndex = hashBuckets.size();
     } else {
       // Search the hash bucket constraints from right to left, looking for the

http://git-wip-us.apache.org/repos/asf/kudu/blob/dd49515f/java/kudu-client/src/main/java/org/apache/kudu/util/ByteVec.java
----------------------------------------------------------------------
diff --git a/java/kudu-client/src/main/java/org/apache/kudu/util/ByteVec.java 
b/java/kudu-client/src/main/java/org/apache/kudu/util/ByteVec.java
index 8d50214..274840c 100644
--- a/java/kudu-client/src/main/java/org/apache/kudu/util/ByteVec.java
+++ b/java/kudu-client/src/main/java/org/apache/kudu/util/ByteVec.java
@@ -113,7 +113,7 @@ public final class ByteVec {
    *
    * @param additional capacity to reserve
    */
-  public void reserve(int additional) {
+  public void reserveAdditional(int additional) {
     Preconditions.checkArgument(additional >= 0, "negative additional");
     if (data.length - len >= additional) return;
     // Use a 1.5x growth factor. According to
@@ -169,7 +169,7 @@ public final class ByteVec {
    * @param element the element to append
    */
   public void push(byte element) {
-    reserve(1);
+    reserveAdditional(1);
     data[len++] = element;
   }
 
@@ -193,7 +193,7 @@ public final class ByteVec {
    * @param len the number of bytes from {@code values} to append
    */
   public void append(byte[] values, int offset, int len) {
-    reserve(len);
+    reserveAdditional(len);
     System.arraycopy(values, offset, this.data, this.len, len);
     this.len += len;
   }

http://git-wip-us.apache.org/repos/asf/kudu/blob/dd49515f/java/kudu-client/src/test/java/org/apache/kudu/util/TestByteVec.java
----------------------------------------------------------------------
diff --git 
a/java/kudu-client/src/test/java/org/apache/kudu/util/TestByteVec.java 
b/java/kudu-client/src/test/java/org/apache/kudu/util/TestByteVec.java
index a1720ee..8761512 100644
--- a/java/kudu-client/src/test/java/org/apache/kudu/util/TestByteVec.java
+++ b/java/kudu-client/src/test/java/org/apache/kudu/util/TestByteVec.java
@@ -76,13 +76,13 @@ public class TestByteVec {
       assertNotEquals(vals, copy.asList());
     }
 
-    // reserve
+    // reserveAdditional
     int unused = copy.capacity() - copy.len();
 
-    copy.reserve(unused);
+    copy.reserveAdditional(unused);
     assertEquals(vec.capacity(), copy.capacity());
 
-    copy.reserve(unused + 1);
+    copy.reserveAdditional(unused + 1);
     assertTrue(copy.capacity() > vec.capacity());
 
     // reserveExact

Reply via email to