carbondata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chenliang...@apache.org
Subject [1/2] carbondata git commit: supported char for hive
Date Thu, 08 Jun 2017 13:20:10 GMT
Repository: carbondata
Updated Branches:
  refs/heads/master 761117908 -> ed205fe23


supported char for hive


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

Branch: refs/heads/master
Commit: 5ff2c50307b1a9f58e385bed6d1c6c143ddfd9c2
Parents: 7611179
Author: anubhav100 <anubhav.tarar@knoldus.in>
Authored: Sat May 27 00:19:27 2017 +0530
Committer: chenliang613 <chenliang613@apache.org>
Committed: Thu Jun 8 21:19:05 2017 +0800

----------------------------------------------------------------------
 .../org/apache/carbondata/hive/CarbonHiveRecordReader.java   | 2 ++
 .../java/org/apache/carbondata/hive/CarbonHiveSerDe.java     | 2 ++
 .../org/apache/carbondata/hive/CarbonObjectInspector.java    | 8 ++++++--
 3 files changed, 10 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/carbondata/blob/5ff2c503/integration/hive/src/main/java/org/apache/carbondata/hive/CarbonHiveRecordReader.java
----------------------------------------------------------------------
diff --git a/integration/hive/src/main/java/org/apache/carbondata/hive/CarbonHiveRecordReader.java
b/integration/hive/src/main/java/org/apache/carbondata/hive/CarbonHiveRecordReader.java
index add4baf..81c3abf 100644
--- a/integration/hive/src/main/java/org/apache/carbondata/hive/CarbonHiveRecordReader.java
+++ b/integration/hive/src/main/java/org/apache/carbondata/hive/CarbonHiveRecordReader.java
@@ -234,6 +234,8 @@ public class CarbonHiveRecordReader extends CarbonRecordReader<ArrayWritable>
         return new TimestampWritable(new Timestamp((long) obj));
       case STRING:
         return new Text(obj.toString());
+      case CHAR:
+        return new Text(obj.toString());
       case DECIMAL:
         return new HiveDecimalWritable(
             HiveDecimal.create(((org.apache.spark.sql.types.Decimal) obj).toJavaBigDecimal()));

http://git-wip-us.apache.org/repos/asf/carbondata/blob/5ff2c503/integration/hive/src/main/java/org/apache/carbondata/hive/CarbonHiveSerDe.java
----------------------------------------------------------------------
diff --git a/integration/hive/src/main/java/org/apache/carbondata/hive/CarbonHiveSerDe.java
b/integration/hive/src/main/java/org/apache/carbondata/hive/CarbonHiveSerDe.java
index 3a5c50a..c6b0365 100644
--- a/integration/hive/src/main/java/org/apache/carbondata/hive/CarbonHiveSerDe.java
+++ b/integration/hive/src/main/java/org/apache/carbondata/hive/CarbonHiveSerDe.java
@@ -201,6 +201,8 @@ public class CarbonHiveSerDe extends AbstractSerDe {
         return ((DateObjectInspector) inspector).getPrimitiveWritableObject(obj);
       case STRING:
         return ((StringObjectInspector) inspector).getPrimitiveWritableObject(obj);
+      case CHAR:
+        return ((StringObjectInspector) inspector).getPrimitiveWritableObject(obj);
       case DECIMAL:
         return ((HiveDecimalObjectInspector) inspector).getPrimitiveWritableObject(obj);
     }

http://git-wip-us.apache.org/repos/asf/carbondata/blob/5ff2c503/integration/hive/src/main/java/org/apache/carbondata/hive/CarbonObjectInspector.java
----------------------------------------------------------------------
diff --git a/integration/hive/src/main/java/org/apache/carbondata/hive/CarbonObjectInspector.java
b/integration/hive/src/main/java/org/apache/carbondata/hive/CarbonObjectInspector.java
index f6ab256..0692fc8 100644
--- a/integration/hive/src/main/java/org/apache/carbondata/hive/CarbonObjectInspector.java
+++ b/integration/hive/src/main/java/org/apache/carbondata/hive/CarbonObjectInspector.java
@@ -26,6 +26,7 @@ import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector;
 import org.apache.hadoop.hive.serde2.objectinspector.SettableStructObjectInspector;
 import org.apache.hadoop.hive.serde2.objectinspector.StructField;
 import org.apache.hadoop.hive.serde2.objectinspector.primitive.PrimitiveObjectInspectorFactory;
+import org.apache.hadoop.hive.serde2.typeinfo.CharTypeInfo;
 import org.apache.hadoop.hive.serde2.typeinfo.DecimalTypeInfo;
 import org.apache.hadoop.hive.serde2.typeinfo.ListTypeInfo;
 import org.apache.hadoop.hive.serde2.typeinfo.StructTypeInfo;
@@ -69,7 +70,7 @@ public class CarbonObjectInspector extends SettableStructObjectInspector
{
       return PrimitiveObjectInspectorFactory.writableStringObjectInspector;
     } else if (typeInfo instanceof DecimalTypeInfo) {
       return PrimitiveObjectInspectorFactory.getPrimitiveWritableObjectInspector(
-        (DecimalTypeInfo) typeInfo);
+          (DecimalTypeInfo) typeInfo);
     } else if (typeInfo.getCategory().equals(Category.STRUCT)) {
       return new CarbonObjectInspector((StructTypeInfo) typeInfo);
     } else if (typeInfo.getCategory().equals(Category.LIST)) {
@@ -81,6 +82,9 @@ public class CarbonObjectInspector extends SettableStructObjectInspector
{
       return PrimitiveObjectInspectorFactory.writableTimestampObjectInspector;
     } else if (typeInfo.equals(TypeInfoFactory.dateTypeInfo)) {
       return PrimitiveObjectInspectorFactory.writableDateObjectInspector;
+    } else if (((CharTypeInfo) typeInfo).getPrimitiveCategory()
+        .name().equals("CHAR")) {
+      return PrimitiveObjectInspectorFactory.writableStringObjectInspector;
     } else {
       throw new UnsupportedOperationException("Unknown field type: " + typeInfo);
     }
@@ -119,7 +123,7 @@ public class CarbonObjectInspector extends SettableStructObjectInspector
{
       int listSize = isArray ? ((Object[]) ((Object[]) data)).length : ((List) data).size();
       int fieldID = fieldRef.getFieldID();
       return fieldID >= listSize ? null :
-        (isArray ? ((Object[]) ((Object[]) data))[fieldID] : ((List) data).get(fieldID));
+          (isArray ? ((Object[]) ((Object[]) data))[fieldID] : ((List) data).get(fieldID));
     }
   }
 


Mime
View raw message