You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by ay...@apache.org on 2022/09/23 22:26:11 UTC

[hive] branch master updated: HIVE-14514: Cloning writerOptions when creating delete event writers in OrcRecordUpdater. (#3610). (Dmitriy Fingerman, reviewed by Ayush Saxena)

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

ayushsaxena 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 0384aae0094 HIVE-14514: Cloning writerOptions when creating delete event writers in OrcRecordUpdater. (#3610). (Dmitriy Fingerman, reviewed by Ayush Saxena)
0384aae0094 is described below

commit 0384aae0094c6a057655bda2c02db139c6510fa5
Author: Dmitriy Fingerman <dm...@gmail.com>
AuthorDate: Fri Sep 23 18:25:59 2022 -0400

    HIVE-14514: Cloning writerOptions when creating delete event writers in OrcRecordUpdater. (#3610). (Dmitriy Fingerman, reviewed by Ayush Saxena)
---
 .../org/apache/hadoop/hive/ql/io/orc/OrcFile.java     |  7 ++++++-
 .../hadoop/hive/ql/io/orc/OrcRecordUpdater.java       | 19 +++++--------------
 2 files changed, 11 insertions(+), 15 deletions(-)

diff --git a/ql/src/java/org/apache/hadoop/hive/ql/io/orc/OrcFile.java b/ql/src/java/org/apache/hadoop/hive/ql/io/orc/OrcFile.java
index 9e998872b6e..151a33db28b 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/io/orc/OrcFile.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/io/orc/OrcFile.java
@@ -146,7 +146,8 @@ public final class OrcFile extends org.apache.orc.OrcFile {
   /**
    * Options for creating ORC file writers.
    */
-  public static class WriterOptions extends org.apache.orc.OrcFile.WriterOptions {
+  public static class WriterOptions extends org.apache.orc.OrcFile.WriterOptions
+          implements Cloneable {
     private boolean explicitSchema = false;
     private ObjectInspector inspector = null;
     // Setting the default batch size to 1000 makes the memory check at 5000
@@ -166,6 +167,10 @@ public final class OrcFile extends org.apache.orc.OrcFile {
       isCompaction = AcidUtils.isCompactionTable(tableProperties);
     }
 
+    public WriterOptions clone() {
+        return (WriterOptions) super.clone();
+    }
+
    /**
      * A required option that sets the object inspector for the rows. If
      * setSchema is not called, it also defines the schema.
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/io/orc/OrcRecordUpdater.java b/ql/src/java/org/apache/hadoop/hive/ql/io/orc/OrcRecordUpdater.java
index 54617fa0bca..cf73c9551eb 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/io/orc/OrcRecordUpdater.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/io/orc/OrcRecordUpdater.java
@@ -336,20 +336,11 @@ public class OrcRecordUpdater implements RecordUpdater {
         // The actual initialization of a writer only happens if any delete events are written
         //to avoid empty files.
         this.deleteEventPath = AcidUtils.createFilename(partitionRoot, deleteOptions);
-        /**
-         * HIVE-14514 is not done so we can't clone writerOptions().  So here we create a new
-         * options object to make sure insert and delete writers don't share them (like the
-         * callback object, for example)
-         * In any case insert writer and delete writer would most likely have very different
-         * characteristics - delete writer only writes a tiny amount of data.  Once we do early
-         * update split, each {@link OrcRecordUpdater} will have only 1 writer. (except for Mutate API)
-         * Then it would perhaps make sense to take writerOptions as input - how?.
-         */
-        this.deleteWriterOptions = OrcFile.writerOptions(optionsCloneForDelta.getTableProperties(),
-          optionsCloneForDelta.getConfiguration());
-        this.deleteWriterOptions.inspector(createEventObjectInspector(findRecId(options.getInspector(),
-          options.getRecordIdColumn())));
-        this.deleteWriterOptions.setSchema(createEventSchemaFromTableProperties(options.getTableProperties()));
+        this.deleteWriterOptions = writerOptions
+                .clone()
+                .inspector(createEventObjectInspector(findRecId(options.getInspector(),
+                        options.getRecordIdColumn())))
+                .setSchema(createEventSchemaFromTableProperties(options.getTableProperties()));
       }
 
       // get buffer size and stripe size for base writer