Hey all -

I'm taking a look at boolean support and started by making just this simple
change. Basically just remove the bits that throw exceptions for boolean
fields.

Using pig 0.9 I ran a simple query against a table with booleans and it
worked just fine. DataType.BOOLEAN already exists (even in pig 0.8),
"describe" showed the fields as boolean, and dump printed out true/false as
expected.

Am I missing something? The user seems better off by not throwing an
exception here because if their pig can handle booleans their query runs.


TW-MBP13-TCrawford:hcatalog travis$ git diff
diff --git
a/hcatalog-pig-adapter/src/main/java/org/apache/hcatalog/pig/PigHCatUtil.java
b/hcatalog-pig-adapter/src/main/java/org/apache/hcatalog/pig/PigHCatUtil.java
index 696081f..fe686cd 100644
---
a/hcatalog-pig-adapter/src/main/java/org/apache/hcatalog/pig/PigHCatUtil.java
+++
b/hcatalog-pig-adapter/src/main/java/org/apache/hcatalog/pig/PigHCatUtil.java
@@ -298,9 +298,7 @@ public class PigHCatUtil {
     }

     if (type == Type.BOOLEAN){
*-      errMsg = "HCatalog column type 'BOOLEAN' is not supported in " +
-      "Pig as a column type";
-      throw new PigException(errMsg, PIG_EXCEPTION_CODE);
+        return DataType.BOOLEAN;
*     }

     errMsg = "HCatalog column type '"+ type.toString() +"' is not
supported in Pig as a column type";
@@ -409,7 +407,6 @@ public class PigHCatUtil {
       // We don't do type promotion/demotion.
       case SMALLINT:
       case TINYINT:
*-      case BOOLEAN:
*         throw new PigException("Incompatible type found in hcat table
schema: "+hcatField, PigHCatUtil.PIG_EXCEPTION_CODE);
       case ARRAY:

 validateHCatSchemaFollowsPigRules(hcatField.getArrayElementSchema());
TW-MBP13-TCrawford:hcatalog travis$

--travis

Reply via email to