@Override
  public BigDecimal getBigDecimal(int columnIndex) throws SQLException {
    final Object val = getObject(columnIndex);
    if (val == null) {
      return null;
    }
    if (val instanceof BigDecimal) {
      return (BigDecimal) val;
    }
    throw new SQLException("Illegal conversion to BigDecimal from column " + columnIndex + " [" + val + "]");
  }
Data independent base class which implements the common part of all Hive
result sets.
jdbc/src/java/org/apache/hive/jdbc/HiveBaseResultSet.java