This is an automated email from the ASF dual-hosted git repository.

mahesh pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hive.git


The following commit(s) were added to refs/heads/master by this push:
     new 2c80394  HIVE-25638 : Select returns deleted records in Hive ACID 
table (Mahesh Kumar Behera,  reviewed by Adam Szita)
2c80394 is described below

commit 2c803945c0a75a2e0898f39b0dd424d5a59f279b
Author: mahesh kumar behera <[email protected]>
AuthorDate: Fri Oct 29 20:39:13 2021 +0530

    HIVE-25638 : Select returns deleted records in Hive ACID table (Mahesh 
Kumar Behera,  reviewed by Adam Szita)
---
 .../ql/io/orc/VectorizedOrcAcidRowBatchReader.java |  2 +-
 .../orc/TestVectorizedOrcAcidRowBatchReader.java   | 22 +++++++++++++++-------
 2 files changed, 16 insertions(+), 8 deletions(-)

diff --git 
a/ql/src/java/org/apache/hadoop/hive/ql/io/orc/VectorizedOrcAcidRowBatchReader.java
 
b/ql/src/java/org/apache/hadoop/hive/ql/io/orc/VectorizedOrcAcidRowBatchReader.java
index 2b70378..385db48 100644
--- 
a/ql/src/java/org/apache/hadoop/hive/ql/io/orc/VectorizedOrcAcidRowBatchReader.java
+++ 
b/ql/src/java/org/apache/hadoop/hive/ql/io/orc/VectorizedOrcAcidRowBatchReader.java
@@ -586,7 +586,7 @@ public class VectorizedOrcAcidRowBatchReader
       maxKey = keyIndex[lastStripeIndex];
     } else {
       if(columnStatsPresent) {
-        maxKey = 
getKeyInterval(stats.get(firstStripeIndex).getColumnStatistics()).getMaxKey();
+        maxKey = 
getKeyInterval(stats.get(lastStripeIndex).getColumnStatistics()).getMaxKey();
       }
     }
     OrcRawRecordMerger.KeyInterval keyInterval =
diff --git 
a/ql/src/test/org/apache/hadoop/hive/ql/io/orc/TestVectorizedOrcAcidRowBatchReader.java
 
b/ql/src/test/org/apache/hadoop/hive/ql/io/orc/TestVectorizedOrcAcidRowBatchReader.java
index 0f78799..b7fd6ac 100644
--- 
a/ql/src/test/org/apache/hadoop/hive/ql/io/orc/TestVectorizedOrcAcidRowBatchReader.java
+++ 
b/ql/src/test/org/apache/hadoop/hive/ql/io/orc/TestVectorizedOrcAcidRowBatchReader.java
@@ -244,12 +244,13 @@ public class TestVectorizedOrcAcidRowBatchReader {
 
     //create 3 insert deltas so that we have 3 splits
     RecordUpdater updater = new OrcRecordUpdater(root, options);
-    updater.insert(options.getMinimumWriteId(),
-        new DummyRow(1, 0, options.getMinimumWriteId(), bucket));
-    updater.insert(options.getMinimumWriteId(),
-        new DummyRow(2, 1, options.getMinimumWriteId(), bucket));
-    updater.insert(options.getMinimumWriteId(),
-        new DummyRow(3, 2, options.getMinimumWriteId(), bucket));
+
+    //In the first delta add 2000 recs to simulate recs in multiple stripes.
+    int numRows = 2000;
+    for (int i = 1; i <= numRows; i++) {
+      updater.insert(options.getMinimumWriteId(),
+              new DummyRow(i, i-1, options.getMinimumWriteId(), bucket));
+    }
     updater.close(false);
 
     options.minimumWriteId(2)
@@ -328,7 +329,7 @@ public class TestVectorizedOrcAcidRowBatchReader {
     if(filterOn) {
       assertEquals(new OrcRawRecordMerger.KeyInterval(
           new RecordIdentifier(1, bucketProperty, 0),
-          new RecordIdentifier(1, bucketProperty, 2)),
+          new RecordIdentifier(1, bucketProperty, numRows - 1)),
           keyInterval);
     }
     else {
@@ -385,6 +386,13 @@ public class TestVectorizedOrcAcidRowBatchReader {
     HiveConf.setBoolVar(conf, HiveConf.ConfVars.HIVETESTMODEACIDKEYIDXSKIP, 
true);
     testDeleteEventFiltering2();
   }
+  @Test
+  public void testDeleteEventFilteringOnWithoutIdx3() throws Exception {
+    HiveConf.setBoolVar(conf, HiveConf.ConfVars.FILTER_DELETE_EVENTS, true);
+    HiveConf.setBoolVar(conf, HiveConf.ConfVars.HIVETESTMODEACIDKEYIDXSKIP, 
true);
+    conf.set("orc.stripe.size", "1000");
+    testDeleteEventFiltering();
+  }
 
   private void testDeleteEventFiltering2() throws Exception {
     boolean filterOn =

Reply via email to