hawq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From odiache...@apache.org
Subject incubator-hawq git commit: HAWQ-975. Fixed type validation.
Date Tue, 30 Aug 2016 00:15:00 GMT
Repository: incubator-hawq
Updated Branches:
  refs/heads/HAWQ-992 7404083bf -> a4f23c446


HAWQ-975. Fixed type validation.


Project: http://git-wip-us.apache.org/repos/asf/incubator-hawq/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-hawq/commit/a4f23c44
Tree: http://git-wip-us.apache.org/repos/asf/incubator-hawq/tree/a4f23c44
Diff: http://git-wip-us.apache.org/repos/asf/incubator-hawq/diff/a4f23c44

Branch: refs/heads/HAWQ-992
Commit: a4f23c446829d7deb940ba50c2ad2e0f2e9a0be1
Parents: 7404083
Author: Oleksandr Diachenko <odiachenko@pivotal.io>
Authored: Mon Aug 29 17:14:50 2016 -0700
Committer: Oleksandr Diachenko <odiachenko@pivotal.io>
Committed: Mon Aug 29 17:14:50 2016 -0700

----------------------------------------------------------------------
 .../pxf/plugins/hive/utilities/HiveUtilities.java     |  6 +++---
 .../pxf/plugins/hive/utilities/HiveUtilitiesTest.java | 14 ++++++++++++++
 2 files changed, 17 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/a4f23c44/pxf/pxf-hive/src/main/java/org/apache/hawq/pxf/plugins/hive/utilities/HiveUtilities.java
----------------------------------------------------------------------
diff --git a/pxf/pxf-hive/src/main/java/org/apache/hawq/pxf/plugins/hive/utilities/HiveUtilities.java
b/pxf/pxf-hive/src/main/java/org/apache/hawq/pxf/plugins/hive/utilities/HiveUtilities.java
index 6e8c315..8b90349 100644
--- a/pxf/pxf-hive/src/main/java/org/apache/hawq/pxf/plugins/hive/utilities/HiveUtilities.java
+++ b/pxf/pxf-hive/src/main/java/org/apache/hawq/pxf/plugins/hive/utilities/HiveUtilities.java
@@ -309,10 +309,10 @@ public class HiveUtilities {
             break;
         }
 
-        if (!hiveToHawqType.getHawqType().equals(expectedHawqType)) {
+        if (!expectedHawqType.getDataType().equals(hawqDataType)) {
             throw new UnsupportedTypeException("Invalid definition for column " + hawqColumnName

-                                    +  ": expected HAWQ type " + expectedHawqType.getTypeName()
+
-                    ", actual HAWQ type " + hiveToHawqType.getHawqType().getTypeName() +
")");
+                                    +  ": expected HAWQ type " + expectedHawqType.getDataType()
+
+                    ", actual HAWQ type " + hawqDataType + ")");
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/a4f23c44/pxf/pxf-hive/src/test/java/org/apache/hawq/pxf/plugins/hive/utilities/HiveUtilitiesTest.java
----------------------------------------------------------------------
diff --git a/pxf/pxf-hive/src/test/java/org/apache/hawq/pxf/plugins/hive/utilities/HiveUtilitiesTest.java
b/pxf/pxf-hive/src/test/java/org/apache/hawq/pxf/plugins/hive/utilities/HiveUtilitiesTest.java
index e3db7ba..f14d77d 100644
--- a/pxf/pxf-hive/src/test/java/org/apache/hawq/pxf/plugins/hive/utilities/HiveUtilitiesTest.java
+++ b/pxf/pxf-hive/src/test/java/org/apache/hawq/pxf/plugins/hive/utilities/HiveUtilitiesTest.java
@@ -229,6 +229,20 @@ public class HiveUtilitiesTest {
                     + Arrays.toString(new String[]{"38", "17"});
             assertEquals(errorMsg, e.getMessage());
         }
+
+
+        //Different types, which are not mapped to each other
+        try {
+            hawqModifiers = new Integer[]{};
+            HiveUtilities.validateTypeCompatible(DataType.NUMERIC, hawqModifiers, "boolean",
columnName);
+            fail("should fail with incompatible types message");
+        }
+        catch (UnsupportedTypeException e) {
+            String errorMsg = "Invalid definition for column " + columnName
+                    + ": expected HAWQ type " + DataType.BOOLEAN
+                    + ", actual HAWQ type " + DataType.NUMERIC + ")";
+            assertEquals(errorMsg, e.getMessage());
+        }
     }
 
     @Test


Mime
View raw message