hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ngan...@apache.org
Subject hive git commit: HIVE-16663: String Caching For Rows (Beluga Behr, reviewed by Naveen Gangam, Ashutosh)
Date Wed, 01 Nov 2017 15:32:29 GMT
Repository: hive
Updated Branches:
  refs/heads/master c0a8c23da -> 497f2651d


HIVE-16663: String Caching For Rows (Beluga Behr, reviewed by Naveen Gangam, Ashutosh)


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

Branch: refs/heads/master
Commit: 497f2651dd84a0489b862ec66eb51369319fce54
Parents: c0a8c23
Author: Naveen Gangam <ngangam@apache.org>
Authored: Wed Nov 1 11:27:36 2017 -0400
Committer: Naveen Gangam <ngangam@apache.org>
Committed: Wed Nov 1 11:29:18 2017 -0400

----------------------------------------------------------------------
 .../src/java/org/apache/hive/beeline/Rows.java    | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/497f2651/beeline/src/java/org/apache/hive/beeline/Rows.java
----------------------------------------------------------------------
diff --git a/beeline/src/java/org/apache/hive/beeline/Rows.java b/beeline/src/java/org/apache/hive/beeline/Rows.java
index cd90268..56c0069 100644
--- a/beeline/src/java/org/apache/hive/beeline/Rows.java
+++ b/beeline/src/java/org/apache/hive/beeline/Rows.java
@@ -154,18 +154,22 @@ abstract class Rows implements Iterator {
       } catch (Throwable t) {
       }
 
-      for (int i = 0; i < size; i++) {
+       for (int i = 0; i < size; i++) {
         Object o = rs.getObject(i + 1);
-        if(rs.wasNull()) {
-          values[i] = nullStr;
+        String value = null;
+
+        if (o == null) {
+          value = nullStr;
         } else if (o instanceof Number) {
-          values[i] = numberFormat != null ? numberFormat.format(o) : o.toString() ;
+          value = numberFormat != null ? numberFormat.format(o) : o.toString();
         } else if (o instanceof byte[]) {
-          values[i] = convertBinaryArray ? new String((byte[])o) : Arrays.toString((byte[])o);
+          value = convertBinaryArray ? new String((byte[])o) : Arrays.toString((byte[])o);
         } else {
-          values[i] = o.toString();
+          value = o.toString();
         }
-        sizes[i] = values[i].length();
+
+        values[i] = value.intern();
+        sizes[i] = value.length();
       }
     }
   }


Mime
View raw message