Github user GodenYao commented on a diff in the pull request:
https://github.com/apache/incubator-hawq/pull/873#discussion_r77077634
--- Diff:
pxf/pxf-hive/src/main/java/org/apache/hawq/pxf/plugins/hive/utilities/EnumHiveToHawqType.java
---
@@ -110,4 +122,68 @@ public static EnumHiveToHawqType
getHiveToHawqType(String hiveType) {
+ hiveType + " to HAWQ's type");
}
+
+ /**
+ *
+ * @param dataType Hawq data type
+ * @return compatible Hive type to given Hawq type, if there are more
than one compatible types, it returns one with bigger size
+ * @throws UnsupportedTypeException if there is no corresponding Hive
type for given Hawq type
+ */
+ public static EnumHiveToHawqType getCompatibleHawqToHiveType(DataType
dataType) {
+
+ SortedSet<EnumHiveToHawqType> types = new
TreeSet<EnumHiveToHawqType>(
+ new Comparator<EnumHiveToHawqType>() {
+ public int compare(EnumHiveToHawqType a,
+ EnumHiveToHawqType b) {
+ return Byte.compare(a.getSize(), b.getSize());
+ }
+ });
+
+ for (EnumHiveToHawqType t : values()) {
+ if (t.getHawqType().getDataType().equals(dataType)) {
+ types.add(t);
+ }
+ }
+
+ if (types.size() == 0)
+ throw new UnsupportedTypeException("Unable to find compatible
Hive type for given HAWQ's type: " + dataType);
+
--- End diff --
the error message should be reversed:
> Unable to find compatible **HAWQ** type for given **Hive**'s type
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---