static Boolean extractSqlBoolean(Object value) throws MetaException {
    if (value == null) {
      return null;
    }
    if (value instanceof Boolean) {
      return (Boolean)value;
    }

    // check if oracle db returned 0 or 1 for boolean value
    if (value instanceof Number) {
      try {
        return BooleanUtils.toBooleanObject(Integer.valueOf(((Number) value).intValue()), 1, 0, null);
      } catch (IllegalArgumentException iae) {
        // NOOP
      }
    }
    if (value instanceof String) {
      try {
        return BooleanUtils.toBooleanObject((String) value, "Y", "N", null);
      } catch (IllegalArgumentException iae) {
        // NOOP
      }
    }

    if (value instanceof BigDecimal) {
      BigDecimal bigDecimal = (BigDecimal) value;
      if (bigDecimal.intValue() == 0) {
        return false;
      } else {
        return true;
      }
    }
    throw new MetaException("Cannot extract boolean from column value " + value);
  }
Convert a boolean value returned from the RDBMS to a Java Boolean object.
MySQL has booleans, but e.g. Derby uses 'Y'/'N' mapping and Oracle DB
doesn't supports boolean, so we have used Number to store the value,
which maps to BigDecimal.

@param value
         column value from the database
@return The Boolean value of the database column value, null if the column
        value is null
@throws MetaException
          if the column value cannot be converted into a Boolean object
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/MetastoreDirectSqlUtils.java