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 2017/03/01 20:02:06 UTC

[2/2] kudu git commit: KUDU-1904 Don't seek on empty RLE blocks

KUDU-1904 Don't seek on empty RLE blocks

Seeking in RLE blocks enforces that the seek position is less than
the number of elements in the block. If the number of elements is 0,
as it is when the entire set of cells is NULL, this check will always
result in a crash.

This patch enforces that the block only seeks if there are elements
in the block.

Test coverage will be added in an upcoming commit.

Change-Id: I6d6bd95099c9f30aa923a0da1e76f92ed90ebd99
Reviewed-on: http://gerrit.cloudera.org:8080/6201
Reviewed-by: Jean-Daniel Cryans <jd...@apache.org>
Tested-by: Jean-Daniel Cryans <jd...@apache.org>


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

Branch: refs/heads/branch-1.2.x
Commit: f5fa1827b3bc3c87f4ade67ce9dee2a7cb804cef
Parents: 711916a
Author: Andrew Wong <aw...@cloudera.com>
Authored: Tue Feb 28 14:13:05 2017 -0800
Committer: Jean-Daniel Cryans <jd...@apache.org>
Committed: Wed Mar 1 19:36:15 2017 +0000

----------------------------------------------------------------------
 src/kudu/cfile/rle_block.h | 4 ++++
 1 file changed, 4 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/f5fa1827/src/kudu/cfile/rle_block.h
----------------------------------------------------------------------
diff --git a/src/kudu/cfile/rle_block.h b/src/kudu/cfile/rle_block.h
index c7702f1..c8ed76b 100644
--- a/src/kudu/cfile/rle_block.h
+++ b/src/kudu/cfile/rle_block.h
@@ -330,6 +330,10 @@ class RleIntBlockDecoder final : public BlockDecoder {
 
   virtual void SeekToPositionInBlock(uint pos) OVERRIDE {
     CHECK(parsed_) << "Must call ParseHeader()";
+    // If the block is empty (e.g. the column is filled with nulls), there is no data to seek.
+    if (PREDICT_FALSE(num_elems_ == 0)) {
+      return;
+    }
     CHECK_LT(pos, num_elems_)
         << "Tried to seek to " << pos << " which is >= number of elements ("
         << num_elems_ << ") in the block!.";