The issue before pig 0.10 is that the parser won't allow booleans in certain 
locations.  For example, 

A = load 'foo';
B = foreach A generate mybool; -- where mybool is a boolean

will fail.  Half baked supported is worse than no support.  In Pig 0.10 I think 
your changes make sense.  We could declare that HCat 0.5 works wit Pig 0.10 and 
then make these changes on HCat trunk.

Alan.

On Jul 20, 2012, at 2:06 PM, Travis Crawford wrote:

> 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