You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by rb...@apache.org on 2020/02/01 11:30:37 UTC

[hive] branch master updated: HIVE-22798: Fix/Optimize: PrimitiveTypeInfo::getPrimitiveTypeEntry (Rajesh Balamohan, reviewed by Gopal V)

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

rbalamohan 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 7792ded  HIVE-22798: Fix/Optimize: PrimitiveTypeInfo::getPrimitiveTypeEntry (Rajesh Balamohan, reviewed by Gopal V)
7792ded is described below

commit 7792ded8added2d47b61e1d1191c0d274f9d1466
Author: Rajesh Balamohan <rb...@apache.org>
AuthorDate: Sat Feb 1 17:00:24 2020 +0530

    HIVE-22798: Fix/Optimize: PrimitiveTypeInfo::getPrimitiveTypeEntry (Rajesh Balamohan, reviewed by Gopal V)
---
 .../apache/hadoop/hive/serde2/typeinfo/PrimitiveTypeInfo.java    | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/PrimitiveTypeInfo.java b/serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/PrimitiveTypeInfo.java
index 0394ffa..f93c933 100644
--- a/serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/PrimitiveTypeInfo.java
+++ b/serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/PrimitiveTypeInfo.java
@@ -43,6 +43,8 @@ public class PrimitiveTypeInfo extends TypeInfo implements Serializable {
   // Base name (varchar vs fully qualified name such as varchar(200)).
   protected String typeName;
 
+  protected transient PrimitiveTypeEntry typeEntry;
+
   /**
    * For java serialization use only.
    */
@@ -55,6 +57,7 @@ public class PrimitiveTypeInfo extends TypeInfo implements Serializable {
   PrimitiveTypeInfo(String typeName) {
     Objects.requireNonNull(typeName);
     this.typeName = typeName;
+    this.typeEntry = PrimitiveObjectInspectorUtils.getTypeEntryFromTypeName(typeName);
   }
 
   /**
@@ -80,6 +83,7 @@ public class PrimitiveTypeInfo extends TypeInfo implements Serializable {
   // The following 2 methods are for java serialization use only.
   public void setTypeName(String typeName) {
     this.typeName = typeName;
+    this.typeEntry = null;
   }
 
   @Override
@@ -88,7 +92,10 @@ public class PrimitiveTypeInfo extends TypeInfo implements Serializable {
   }
 
   public PrimitiveTypeEntry getPrimitiveTypeEntry() {
-    return PrimitiveObjectInspectorUtils.getTypeEntryFromTypeName(typeName);
+    if (typeEntry == null) {
+      typeEntry = PrimitiveObjectInspectorUtils.getTypeEntryFromTypeName(typeName);
+    }
+    return typeEntry;
   }
 
   @Override