public static void fillColumnStatisticsData(String colType, ColumnStatisticsData data,
      Object llow, Object lhigh, Object dlow, Object dhigh, Object declow, Object dechigh,
      Object nulls, Object dist, Object bitVector, Object histogram,
      Object avglen, Object maxlen, Object trues, Object falses) throws MetaException {
    colType = colType.toLowerCase();
    if (colType.equals("boolean")) {
      BooleanColumnStatsData boolStats = new BooleanColumnStatsData();
      boolStats.setNumFalses(MetastoreDirectSqlUtils.extractSqlLong(falses));
      boolStats.setNumTrues(MetastoreDirectSqlUtils.extractSqlLong(trues));
      boolStats.setNumNulls(MetastoreDirectSqlUtils.extractSqlLong(nulls));
      data.setBooleanStats(boolStats);
    } else if (colType.equals("string") ||
        colType.startsWith("varchar") || colType.startsWith("char")) {
      StringColumnStatsDataInspector stringStats = new StringColumnStatsDataInspector();
      stringStats.setNumNulls(MetastoreDirectSqlUtils.extractSqlLong(nulls));
      stringStats.setAvgColLen(MetastoreDirectSqlUtils.extractSqlDouble(avglen));
      stringStats.setMaxColLen(MetastoreDirectSqlUtils.extractSqlLong(maxlen));
      stringStats.setNumDVs(MetastoreDirectSqlUtils.extractSqlLong(dist));
      stringStats.setBitVectors(getBitVector(MetastoreDirectSqlUtils.extractSqlBlob(bitVector)));
      data.setStringStats(stringStats);
    } else if (colType.equals("binary")) {
      BinaryColumnStatsData binaryStats = new BinaryColumnStatsData();
      binaryStats.setNumNulls(MetastoreDirectSqlUtils.extractSqlLong(nulls));
      binaryStats.setAvgColLen(MetastoreDirectSqlUtils.extractSqlDouble(avglen));
      binaryStats.setMaxColLen(MetastoreDirectSqlUtils.extractSqlLong(maxlen));
      data.setBinaryStats(binaryStats);
    } else if (colType.equals("bigint") || colType.equals("int") ||
        colType.equals("smallint") || colType.equals("tinyint")) {
      LongColumnStatsDataInspector longStats = new LongColumnStatsDataInspector();
      longStats.setNumNulls(MetastoreDirectSqlUtils.extractSqlLong(nulls));
      if (lhigh != null) {
        longStats.setHighValue(MetastoreDirectSqlUtils.extractSqlLong(lhigh));
      }
      if (llow != null) {
        longStats.setLowValue(MetastoreDirectSqlUtils.extractSqlLong(llow));
      }
      longStats.setNumDVs(MetastoreDirectSqlUtils.extractSqlLong(dist));
      longStats.setBitVectors(getBitVector(MetastoreDirectSqlUtils.extractSqlBlob(bitVector)));
      longStats.setHistogram(getHistogram(MetastoreDirectSqlUtils.extractSqlBlob(histogram)));
      data.setLongStats(longStats);
    } else if (colType.equals("double") || colType.equals("float")) {
      DoubleColumnStatsDataInspector doubleStats = new DoubleColumnStatsDataInspector();
      doubleStats.setNumNulls(MetastoreDirectSqlUtils.extractSqlLong(nulls));
      if (dhigh != null) {
        doubleStats.setHighValue(MetastoreDirectSqlUtils.extractSqlDouble(dhigh));
      }
      if (dlow != null) {
        doubleStats.setLowValue(MetastoreDirectSqlUtils.extractSqlDouble(dlow));
      }
      doubleStats.setNumDVs(MetastoreDirectSqlUtils.extractSqlLong(dist));
      doubleStats.setBitVectors(getBitVector(MetastoreDirectSqlUtils.extractSqlBlob(bitVector)));
      doubleStats.setHistogram(getHistogram(MetastoreDirectSqlUtils.extractSqlBlob(histogram)));
      data.setDoubleStats(doubleStats);
    } else if (colType.startsWith("decimal")) {
      DecimalColumnStatsDataInspector decimalStats = new DecimalColumnStatsDataInspector();
      decimalStats.setNumNulls(MetastoreDirectSqlUtils.extractSqlLong(nulls));
      if (dechigh != null) {
        decimalStats.setHighValue(DecimalUtils.createThriftDecimal((String)dechigh));
      }
      if (declow != null) {
        decimalStats.setLowValue(DecimalUtils.createThriftDecimal((String)declow));
      }
      decimalStats.setNumDVs(MetastoreDirectSqlUtils.extractSqlLong(dist));
      decimalStats.setBitVectors(getBitVector(MetastoreDirectSqlUtils.extractSqlBlob(bitVector)));
      decimalStats.setHistogram(getHistogram(MetastoreDirectSqlUtils.extractSqlBlob(histogram)));
      data.setDecimalStats(decimalStats);
    } else if (colType.equals("date")) {
      DateColumnStatsDataInspector dateStats = new DateColumnStatsDataInspector();
      dateStats.setNumNulls(MetastoreDirectSqlUtils.extractSqlLong(nulls));
      if (lhigh != null) {
        dateStats.setHighValue(new Date(MetastoreDirectSqlUtils.extractSqlLong(lhigh)));
      }
      if (llow != null) {
        dateStats.setLowValue(new Date(MetastoreDirectSqlUtils.extractSqlLong(llow)));
      }
      dateStats.setNumDVs(MetastoreDirectSqlUtils.extractSqlLong(dist));
      dateStats.setBitVectors(getBitVector(MetastoreDirectSqlUtils.extractSqlBlob(bitVector)));
      dateStats.setHistogram(getHistogram(MetastoreDirectSqlUtils.extractSqlBlob(histogram)));
      data.setDateStats(dateStats);
    } else if (colType.equals("timestamp")) {
      TimestampColumnStatsDataInspector timestampStats = new TimestampColumnStatsDataInspector();
      timestampStats.setNumNulls(MetastoreDirectSqlUtils.extractSqlLong(nulls));
      if (lhigh != null) {
        timestampStats.setHighValue(new Timestamp(MetastoreDirectSqlUtils.extractSqlLong(lhigh)));
      }
      if (llow != null) {
        timestampStats.setLowValue(new Timestamp(MetastoreDirectSqlUtils.extractSqlLong(llow)));
      }
      timestampStats.setNumDVs(MetastoreDirectSqlUtils.extractSqlLong(dist));
      timestampStats.setBitVectors(getBitVector(MetastoreDirectSqlUtils.extractSqlBlob(bitVector)));
      timestampStats.setHistogram(getHistogram(MetastoreDirectSqlUtils.extractSqlBlob(histogram)));
      data.setTimestampStats(timestampStats);
    }
  }
This class contains conversion logic that creates Thrift stat objects from
JDO stat objects and plain arrays from DirectSQL.
It is hidden here so that we wouldn't have to look at it in elsewhere.
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/StatObjectConverter.java