public static int getIntFromSchema(Schema schema, String name) {
    Object obj = schema.getObjectProp(name);
    if (obj instanceof String) {
      return Integer.parseInt((String) obj);
    } else if (obj instanceof Integer) {
      return (int) obj;
    } else {
      throw new IllegalArgumentException("Expect integer or string value from property " + name
        + " but found type " + obj.getClass().getName());
    }
  }
Determine if we're being executed from within an MR job or as part
of a select * statement.  The signals for this varies between Hive versions.
@param job that contains things that are or are not set in a job
@return Are we in a job or not?
serde/src/java/org/apache/hadoop/hive/serde2/avro/AvroSerdeUtils.java