Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Threaded View
Drill, mail # dev - [5/7] git commit: DRILL-406: Move JSON integer range to use BigInt instead of Int


Copy link to this message
-
[5/7] git commit: DRILL-406: Move JSON integer range to use BigInt instead of Int
jacques@... 2014-03-18, 03:45
DRILL-406: Move JSON integer range to use BigInt instead of Int
Project: http://git-wip-us.apache.org/repos/asf/incubator-drill/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-drill/commit/11f30a08
Tree: http://git-wip-us.apache.org/repos/asf/incubator-drill/tree/11f30a08
Diff: http://git-wip-us.apache.org/repos/asf/incubator-drill/diff/11f30a08

Branch: refs/heads/master
Commit: 11f30a084954fda5d0f82570468c5a1056402137
Parents: db00e97
Author: Steven Phillips <[EMAIL PROTECTED]>
Authored: Mon Mar 17 09:09:59 2014 -0700
Committer: Jacques Nadeau <[EMAIL PROTECTED]>
Committed: Mon Mar 17 09:09:59 2014 -0700

 .../exec/schema/json/jackson/JacksonHelper.java |  8 +--
 .../exec/store/easy/json/JSONRecordReader.java  | 25 +++----
 .../exec/store/json/JSONRecordReaderTest.java   | 76 ++++++++++----------
 3 files changed, 50 insertions(+), 59 deletions(-)
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/11f30a08/exec/java-exec/src/main/java/org/apache/drill/exec/schema/json/jackson/JacksonHelper.java
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/schema/json/jackson/JacksonHelper.java b/exec/java-exec/src/main/java/org/apache/drill/exec/schema/json/jackson/JacksonHelper.java
index 51f273f..1e54336 100644
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/schema/json/jackson/JacksonHelper.java
@@ -33,8 +33,8 @@ public class JacksonHelper {
   public static final MajorType REPEATED_BOOLEAN_TYPE = Types.repeated(MinorType.BIT);
   public static final MajorType ARRAY_TYPE = Types.repeated(MinorType.LATE);
   public static final MajorType MAP_TYPE = Types.repeated(MinorType.MAP);
-  public static final MajorType INT_TYPE = Types.optional(MinorType.INT);
-  public static final MajorType REPEATED_INT_TYPE = Types.repeated(MinorType.INT);
+  public static final MajorType INT_TYPE = Types.optional(MinorType.BIGINT);
+  public static final MajorType REPEATED_INT_TYPE = Types.repeated(MinorType.BIGINT);
   public static final MajorType FLOAT_TYPE = Types.optional(MinorType.FLOAT4);
   public static final MajorType REPEATED_FLOAT_TYPE = Types.repeated(MinorType.FLOAT4);
   public static final MajorType NULL_TYPE = Types.optional(MinorType.LATE);
@@ -82,8 +82,8 @@ public class JacksonHelper {
 
   public static Object getValueFromFieldType(JsonParser parser, MinorType fieldType) throws IOException {
     switch (fieldType) {
-      case INT:
-        return parser.getIntValue();
+      case BIGINT:
+        return parser.getLongValue();
       case VARCHAR:
         return parser.getValueAsString();
       case FLOAT4:

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/11f30a08/exec/java-exec/src/main/java/org/apache/drill/exec/store/easy/json/JSONRecordReader.java
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/easy/json/JSONRecordReader.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/easy/json/JSONRecordReader.java
index 67e8b3f..80f8678 100644
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/easy/json/JSONRecordReader.java
@@ -52,16 +52,7 @@ import org.apache.drill.exec.schema.SchemaIdGenerator;
 import org.apache.drill.exec.schema.json.jackson.JacksonHelper;
 import org.apache.drill.exec.store.RecordReader;
 import org.apache.drill.exec.store.VectorHolder;
-import org.apache.drill.exec.vector.AllocationHelper;
-import org.apache.drill.exec.vector.NullableBitVector;
-import org.apache.drill.exec.vector.NullableFloat4Vector;
-import org.apache.drill.exec.vector.NullableIntVector;
-import org.apache.drill.exec.vector.NullableVarCharVector;
-import org.apache.drill.exec.vector.RepeatedBitVector;
-import org.apache.drill.exec.vector.RepeatedFloat4Vector;
-import org.apache.drill.exec.vector.RepeatedIntVector;
-import org.apache.drill.exec.vector.RepeatedVarCharVector;
-import org.apache.drill.exec.vector.ValueVector;
+import org.apache.drill.exec.vector.*;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
 
@@ -412,23 +403,23 @@ public class JSONRecordReader implements RecordReader {
 
     private static <T> boolean addValueToVector(int index, VectorHolder holder, T val, MinorType minorType, int groupCount) {
       switch (minorType) {
-        case INT: {
+        case BIGINT: {
           holder.incAndCheckLength(NullableIntHolder.WIDTH * 8 + 1);
           if (groupCount == 0) {
             if (val != null) {
-              NullableIntVector int4 = (NullableIntVector) holder.getValueVector();
-              NullableIntVector.Mutator m = int4.getMutator();
-              m.set(index, (Integer) val);
+              NullableBigIntVector int4 = (NullableBigIntVector) holder.getValueVector();
+              NullableBigIntVector.Mutator m = int4.getMutator();
+              m.set(index, (Long) val);
             }
           } else {
             if (val == null) {
               throw new UnsupportedOperationException("Nullable repeated int is not supported.");
             }
 
-            RepeatedIntVector repeatedInt4 = (RepeatedIntVector) holder.getValueVector();
-            RepeatedIntVector.Mutator m = repeatedInt4.getMutator();
+            RepeatedBigIntVector repeatedInt4 = (RepeatedBigIntVector) holder.getValueVector();
+            RepeatedBigIntVector.Mutator m = repeatedInt4.getMutator();
             holder.setGroupCount(index);
-            m.add(index, (Integer) val);
+            m.add(index, (Long) val);
           }
 
           return holder.hasEnoughSpace(NullableIntHolder.WIDTH * 8 + 1);

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/11f30a08/exec/java-exec/src/test/java/org/apache/drill/exec/store/json/JSONRecordReaderTest.java
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/store/json/JSONRecordReaderTest.java b/exec/java-exec/src/test/java/org/apache/drill/exec/store/json/JSONRecordReaderTest.java
index 41960b6..bfeb892 100644
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/store/json/JSONRecordRead