private void die(String expectedType, Object o) throws IOException {
    throw new IOException("Expected " + expectedType + ", got " +
      o.getClass().getName());
  }
This UDF can be used to check that a tuple presented by HCatLoader has the
right types for the fields

Usage is :

register testudf.jar;
a = load 'numbers' using HCatLoader(...);
b = foreach a generate HCatTypeCheck('intnum1000:int,id:int,intnum5:int,intnum100:int,intnum:int,longnum:long,floatnum:float,doublenum:double', *);
store b into 'output';

The schema string (the first argument to the UDF) is of the form one would provide in a 
pig load statement.

The output should only contain the value '1' in all rows. (This UDF returns
the integer value 1 if all fields have the right type, else throws IOException)
hcatalog/src/test/e2e/hcatalog/udfs/java/org/apache/hive/hcatalog/utils/HCatTypeCheck.java