orc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From prasan...@apache.org
Subject orc git commit: ORC-221: RecordReaderImpl::evaluatePredicateMinMax should check whether predicate.getLiteralList() is empty
Date Tue, 01 Aug 2017 22:53:15 GMT
Repository: orc
Updated Branches:
  refs/heads/branch-1.3 93e636b9f -> 35f17046e


ORC-221: RecordReaderImpl::evaluatePredicateMinMax should check whether predicate.getLiteralList()
is empty

Fixes #145

Signed-off-by: Prasanth Jayachandran <prasanthj@apache.org>


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

Branch: refs/heads/branch-1.3
Commit: 35f17046e39ef2e233b13adcde94f45b18c0c1cc
Parents: 93e636b
Author: Rajesh Balamohan <rbalamohan@apache.org>
Authored: Tue Aug 1 09:30:02 2017 +0530
Committer: Prasanth Jayachandran <prasanthj@apache.org>
Committed: Tue Aug 1 15:52:57 2017 -0700

----------------------------------------------------------------------
 .../java/org/apache/orc/impl/RecordReaderImpl.java    |  3 +++
 .../org/apache/orc/impl/TestRecordReaderImpl.java     | 14 ++++++++++++++
 2 files changed, 17 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/orc/blob/35f17046/java/core/src/java/org/apache/orc/impl/RecordReaderImpl.java
----------------------------------------------------------------------
diff --git a/java/core/src/java/org/apache/orc/impl/RecordReaderImpl.java b/java/core/src/java/org/apache/orc/impl/RecordReaderImpl.java
index 8d9d644..0dacc70 100644
--- a/java/core/src/java/org/apache/orc/impl/RecordReaderImpl.java
+++ b/java/core/src/java/org/apache/orc/impl/RecordReaderImpl.java
@@ -551,6 +551,9 @@ public class RecordReaderImpl implements RecordReader {
         }
       case BETWEEN:
         List<Object> args = predicate.getLiteralList();
+        if (args == null || args.isEmpty()) {
+          return TruthValue.YES_NO;
+        }
         Object predObj1 = getBaseObjectForComparison(predicate.getType(), args.get(0));
 
         loc = compareToRange((Comparable) predObj1, minValue, maxValue);

http://git-wip-us.apache.org/repos/asf/orc/blob/35f17046/java/core/src/test/org/apache/orc/impl/TestRecordReaderImpl.java
----------------------------------------------------------------------
diff --git a/java/core/src/test/org/apache/orc/impl/TestRecordReaderImpl.java b/java/core/src/test/org/apache/orc/impl/TestRecordReaderImpl.java
index fc00699..b259873 100644
--- a/java/core/src/test/org/apache/orc/impl/TestRecordReaderImpl.java
+++ b/java/core/src/test/org/apache/orc/impl/TestRecordReaderImpl.java
@@ -901,6 +901,20 @@ public class TestRecordReaderImpl {
         evaluateInteger(createIntStats(10L, 20L), pred));
     assertEquals(TruthValue.YES_NULL,
         evaluateInteger(createIntStats(12L, 18L), pred));
+
+    // check with empty predicate list
+    args.clear();
+    pred = createPredicateLeaf
+        (PredicateLeaf.Operator.BETWEEN, PredicateLeaf.Type.LONG,
+            "x", null, args);
+    assertEquals(TruthValue.YES_NO,
+        evaluateInteger(createIntStats(0L, 5L), pred));
+    assertEquals(TruthValue.YES_NO,
+        evaluateInteger(createIntStats(30L, 40L), pred));
+    assertEquals(TruthValue.YES_NO,
+        evaluateInteger(createIntStats(5L, 15L), pred));
+    assertEquals(TruthValue.YES_NO,
+        evaluateInteger(createIntStats(10L, 20L), pred));
   }
 
   @Test


Mime
View raw message