Repository: incubator-hawq Updated Branches: refs/heads/HAWQ-992 30aecce5a -> 8b3f416ef
HAWQ-992. PXF Hive data type check in Fragmenter too restrictive. Project: http://git-wip-us.apache.org/repos/asf/incubator-hawq/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-hawq/commit/8b3f416e Tree: http://git-wip-us.apache.org/repos/asf/incubator-hawq/tree/8b3f416e Diff: http://git-wip-us.apache.org/repos/asf/incubator-hawq/diff/8b3f416e Branch: refs/heads/HAWQ-992 Commit: 8b3f416eff5b48e3f41d4b969d7fbbb5a8c2a9ec Parents: 30aecce Author: Oleksandr Diachenko <[email protected]> Authored: Fri Aug 26 17:20:38 2016 -0700 Committer: Oleksandr Diachenko <[email protected]> Committed: Fri Aug 26 17:20:38 2016 -0700 ---------------------------------------------------------------------- .../hive/utilities/HiveUtilitiesTest.java | 4 ++++ .../pxf/service/utilities/ProtocolData.java | 2 +- .../pxf/service/utilities/ProtocolDataTest.java | 23 ++++++++++++++++++++ 3 files changed, 28 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/8b3f416e/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 e94351a..ea1cac1 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 @@ -163,6 +163,10 @@ public class HiveUtilitiesTest { assertEquals(errorMsg, e.getMessage()); } + //HAWQ has wider modifiers than Hive, types are compatible + hawqModifiers = new String[]{"11", "3"}; + HiveUtilities.validateTypeCompatible(DataType.NUMERIC, hawqModifiers, "decimal(10,2)", columnName); + //HAWQ has lesser modifiers than Hive, types aren't compatible try { http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/8b3f416e/pxf/pxf-service/src/main/java/org/apache/hawq/pxf/service/utilities/ProtocolData.java ---------------------------------------------------------------------- diff --git a/pxf/pxf-service/src/main/java/org/apache/hawq/pxf/service/utilities/ProtocolData.java b/pxf/pxf-service/src/main/java/org/apache/hawq/pxf/service/utilities/ProtocolData.java index 2838232..88d3139 100644 --- a/pxf/pxf-service/src/main/java/org/apache/hawq/pxf/service/utilities/ProtocolData.java +++ b/pxf/pxf-service/src/main/java/org/apache/hawq/pxf/service/utilities/ProtocolData.java @@ -402,7 +402,7 @@ public class ProtocolData extends InputData { } private String[] parseTypeMods(int columnIndex) { - String typeModeCountStr = getOptionalProperty("ATTR-TYPEMOD" + columnIndex + "COUNT"); + String typeModeCountStr = getOptionalProperty("ATTR-TYPEMOD" + columnIndex + "-COUNT"); String[] result = null; if (typeModeCountStr != null) { Integer typeModeCount = Integer.parseInt(typeModeCountStr); http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/8b3f416e/pxf/pxf-service/src/test/java/org/apache/hawq/pxf/service/utilities/ProtocolDataTest.java ---------------------------------------------------------------------- diff --git a/pxf/pxf-service/src/test/java/org/apache/hawq/pxf/service/utilities/ProtocolDataTest.java b/pxf/pxf-service/src/test/java/org/apache/hawq/pxf/service/utilities/ProtocolDataTest.java index 8a257ff..03860f9 100644 --- a/pxf/pxf-service/src/test/java/org/apache/hawq/pxf/service/utilities/ProtocolDataTest.java +++ b/pxf/pxf-service/src/test/java/org/apache/hawq/pxf/service/utilities/ProtocolDataTest.java @@ -332,6 +332,29 @@ public class ProtocolDataTest { } } + @Test + public void typeMods() { + + parameters.put("X-GP-ATTRS", "2"); + parameters.put("X-GP-ATTR-NAME0", "vc1"); + parameters.put("X-GP-ATTR-TYPECODE0", "1043"); + parameters.put("X-GP-ATTR-TYPENAME0", "varchar"); + parameters.put("X-GP-ATTR-TYPEMOD0-COUNT", "1"); + parameters.put("X-GP-ATTR-TYPEMOD0-0", "5"); + + parameters.put("X-GP-ATTR-NAME1", "dec1"); + parameters.put("X-GP-ATTR-TYPECODE1", "1700"); + parameters.put("X-GP-ATTR-TYPENAME1", "numeric"); + parameters.put("X-GP-ATTR-TYPEMOD1-COUNT", "2"); + parameters.put("X-GP-ATTR-TYPEMOD1-0", "10"); + parameters.put("X-GP-ATTR-TYPEMOD1-1", "2"); + + ProtocolData protocolData = new ProtocolData(parameters); + + assertEquals(protocolData.getColumn(0).columnTypeModifiers(), new String[]{"5"}); + assertEquals(protocolData.getColumn(1).columnTypeModifiers(), new String[]{"10", "2"}); + } + /* * setUp function called before each test */
