Created
October 2, 2014 01:23
-
-
Save nileema/1f3852c2933923b034b4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/presto-hive/src/main/java/com/facebook/presto/hive/HiveType.java b/presto-hive/src/main/java/com/facebook/presto/hive/HiveType.java | |
index d043fd6..3a5ec58 100644 | |
--- a/presto-hive/src/main/java/com/facebook/presto/hive/HiveType.java | |
+++ b/presto-hive/src/main/java/com/facebook/presto/hive/HiveType.java | |
@@ -26,6 +26,7 @@ import com.fasterxml.jackson.annotation.JsonValue; | |
import com.google.common.base.Function; | |
import com.google.common.collect.ImmutableSet; | |
import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector; | |
+import org.apache.hadoop.hive.serde2.typeinfo.TypeInfo; | |
import org.apache.hadoop.hive.serde2.typeinfo.TypeInfoUtils; | |
import javax.annotation.Nullable; | |
@@ -76,11 +77,13 @@ public final class HiveType | |
private final String hiveTypeName; | |
private final Category category; | |
+ private final TypeInfo typeInfo; | |
private HiveType(String hiveTypeName) | |
{ | |
this.hiveTypeName = checkNotNull(hiveTypeName, "hiveTypeName is null"); | |
- this.category = TypeInfoUtils.getTypeInfoFromTypeString(hiveTypeName).getCategory(); | |
+ this.typeInfo = TypeInfoUtils.getTypeInfoFromTypeString(hiveTypeName); | |
+ this.category = this.typeInfo.getCategory(); | |
} | |
@JsonValue | |
@@ -94,6 +97,11 @@ public final class HiveType | |
return category; | |
} | |
+ public TypeInfo getTypeInfo() | |
+ { | |
+ return typeInfo; | |
+ } | |
+ | |
public static HiveType getSupportedHiveType(String hiveTypeName) | |
{ | |
HiveType hiveType = getHiveType(hiveTypeName); | |
diff --git a/presto-hive/src/main/java/com/facebook/presto/hive/orc/OrcDomainExtractor.java b/presto-hive/src/main/java/com/facebook/presto/hive/orc/OrcDomainExtractor.java | |
index 561d1b7..5fc0613 100644 | |
--- a/presto-hive/src/main/java/com/facebook/presto/hive/orc/OrcDomainExtractor.java | |
+++ b/presto-hive/src/main/java/com/facebook/presto/hive/orc/OrcDomainExtractor.java | |
@@ -33,7 +33,6 @@ import com.google.common.primitives.Primitives; | |
import io.airlift.slice.Slice; | |
import org.apache.hadoop.hive.serde2.typeinfo.PrimitiveTypeInfo; | |
import org.apache.hadoop.hive.serde2.typeinfo.TypeInfo; | |
-import org.apache.hadoop.hive.serde2.typeinfo.TypeInfoUtils; | |
import java.util.List; | |
import java.util.Map; | |
@@ -90,7 +89,7 @@ public final class OrcDomainExtractor | |
Integer streamIndex = entry.getValue(); | |
RowGroupIndex rowGroupIndex = columnIndexes.get(streamIndex).get(rowGroup); | |
- Domain domain = getDomain(toPrestoType(typeManager, columnHandle.getHiveType()), rowCount, rowGroupIndex.getColumnStatistics()); | |
+ Domain domain = getDomain(toPrestoType(typeManager, columnHandle.getHiveType(), columnHandle.getHiveType().getTypeInfo()), rowCount, rowGroupIndex.getColumnStatistics()); | |
domains.put(columnHandle, domain); | |
} | |
return TupleDomain.withColumnDomains(domains.build()); | |
@@ -107,15 +106,14 @@ public final class OrcDomainExtractor | |
HiveColumnHandle columnHandle = entry.getKey(); | |
Integer columnIndex = entry.getValue(); | |
- Domain domain = getDomain(toPrestoType(typeManager, columnHandle.getHiveType()), rowCount, stripeColumnStatistics.get(columnIndex)); | |
+ Domain domain = getDomain(toPrestoType(typeManager, columnHandle.getHiveType(), columnHandle.getHiveType().getTypeInfo()), rowCount, stripeColumnStatistics.get(columnIndex)); | |
domains.put(columnHandle, domain); | |
} | |
return TupleDomain.withColumnDomains(domains.build()); | |
} | |
- private static Type toPrestoType(TypeManager typeManager, HiveType hiveType) | |
+ private static Type toPrestoType(TypeManager typeManager, HiveType hiveType, TypeInfo typeInfo) | |
{ | |
- TypeInfo typeInfo = TypeInfoUtils.getTypeInfoFromTypeString(hiveType.getHiveTypeName()); | |
switch (typeInfo.getCategory()) { | |
case MAP: | |
return VARCHAR; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment