You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by li...@apache.org on 2016/05/23 07:39:10 UTC

hive git commit: HIVE-13789: Repeatedly checking configuration in TextRecordWriter/Reader hurts performance (Rui reviewed by Xuefu)

Repository: hive
Updated Branches:
  refs/heads/master 2f3b1af49 -> fedd6596c


HIVE-13789: Repeatedly checking configuration in TextRecordWriter/Reader hurts performance (Rui reviewed by Xuefu)


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

Branch: refs/heads/master
Commit: fedd6596c54db2d0f30d3e1bb8e279d2580848a7
Parents: 2f3b1af
Author: Rui Li <ru...@intel.com>
Authored: Mon May 23 15:37:27 2016 +0800
Committer: Rui Li <ru...@intel.com>
Committed: Mon May 23 15:38:51 2016 +0800

----------------------------------------------------------------------
 ql/src/java/org/apache/hadoop/hive/ql/exec/TextRecordReader.java | 4 +++-
 ql/src/java/org/apache/hadoop/hive/ql/exec/TextRecordWriter.java | 4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/fedd6596/ql/src/java/org/apache/hadoop/hive/ql/exec/TextRecordReader.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/exec/TextRecordReader.java b/ql/src/java/org/apache/hadoop/hive/ql/exec/TextRecordReader.java
index 8319f11..47ab9c2 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/exec/TextRecordReader.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/exec/TextRecordReader.java
@@ -40,12 +40,14 @@ public class TextRecordReader implements RecordReader {
   private InputStream in;
   private Text row;
   private Configuration conf;
+  private boolean escape;
 
   public void initialize(InputStream in, Configuration conf, Properties tbl)
       throws IOException {
     lineReader = new LineReader(in, conf);
     this.in = in;
     this.conf = conf;
+    escape = HiveConf.getBoolVar(conf, HiveConf.ConfVars.HIVESCRIPTESCAPE);
   }
 
   public Writable createRow() throws IOException {
@@ -60,7 +62,7 @@ public class TextRecordReader implements RecordReader {
 
     int bytesConsumed = lineReader.readLine((Text) row);
 
-    if (HiveConf.getBoolVar(conf, HiveConf.ConfVars.HIVESCRIPTESCAPE)) {
+    if (escape) {
       return HiveUtils.unescapeText((Text) row);
     }
     return bytesConsumed;

http://git-wip-us.apache.org/repos/asf/hive/blob/fedd6596/ql/src/java/org/apache/hadoop/hive/ql/exec/TextRecordWriter.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/exec/TextRecordWriter.java b/ql/src/java/org/apache/hadoop/hive/ql/exec/TextRecordWriter.java
index 10b4594..f15458d 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/exec/TextRecordWriter.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/exec/TextRecordWriter.java
@@ -35,18 +35,20 @@ public class TextRecordWriter implements RecordWriter {
 
   private OutputStream out;
   private Configuration conf;
+  private boolean escape;
 
   public void initialize(OutputStream out, Configuration conf)
       throws IOException {
     this.out = out;
     this.conf = conf;
+    escape = HiveConf.getBoolVar(conf, HiveConf.ConfVars.HIVESCRIPTESCAPE);
   }
 
   public void write(Writable row) throws IOException {
     Text text = (Text) row;
     Text escapeText = text;
 
-    if (HiveConf.getBoolVar(conf, HiveConf.ConfVars.HIVESCRIPTESCAPE)) {
+    if (escape) {
       escapeText = HiveUtils.escapeText(text);
     }