Source:
private static HiveColumnStatistics createHiveColumnStatistics( ConnectorSession session, DateTimeZone timeZone, Map<ColumnStatisticType, Block> computedStatistics, Type columnType, long rowCount) { HiveColumnStatistics.Builder result = HiveColumnStatistics.builder(); if (computedStatistics.containsKey(MIN)) { Block block = computedStatistics.get(MIN); if (!block.isNull(0)) { result.setLowValue(getMinMaxAsMetastoreValue(session, timeZone, columnType, block)); } } if (computedStatistics.containsKey(MAX)) { Block block = computedStatistics.get(MAX); if (!block.isNull(0)) { result.setHighValue(getMinMaxAsMetastoreValue(session, timeZone, columnType, block)); } } if (computedStatistics.containsKey(NUMBER_OF_DISTINCT_VALUES)) { result.setDistinctValuesCount(BigintType.BIGINT.getLong(computedStatistics.get(NUMBER_OF_DISTINCT_VALUES), 0)); } if (computedStatistics.containsKey(MAX_VALUE_SIZE_IN_BYTES)) { result.setMaxColumnLength(BigintType.BIGINT.getLong(computedStatistics.get(MAX_VALUE_SIZE_IN_BYTES), 0)); } if (computedStatistics.containsKey(AVERAGE_VALUE_SIZE_IN_BYTES)) { result.setAverageColumnLength(DOUBLE.getDouble(computedStatistics.get(AVERAGE_VALUE_SIZE_IN_BYTES), 0)); } if (computedStatistics.containsKey(NUMBER_OF_NON_NULL_VALUES)) { result.setNullsCount(rowCount - BigintType.BIGINT.getLong(computedStatistics.get(NUMBER_OF_NON_NULL_VALUES), 0)); } if (computedStatistics.containsKey(NUMBER_OF_TRUE)) { long numberOfTrue = BigintType.BIGINT.getLong(computedStatistics.get(NUMBER_OF_TRUE), 0); result.setTrueCount(numberOfTrue); if (computedStatistics.containsKey(NUMBER_OF_NON_NULL_VALUES)) { long numberOfNonNullValues = BigintType.BIGINT.getLong(computedStatistics.get(NUMBER_OF_NON_NULL_VALUES), 0); result.setFalseCount(numberOfNonNullValues - numberOfTrue); } } return result.build(); }

Target:
private static HiveColumnStatistics createHiveColumnStatistics( ConnectorSession session, DateTimeZone timeZone, Map<ColumnStatisticType, Block> computedStatistics, Type columnType, long rowCount) { HiveColumnStatistics.Builder result = HiveColumnStatistics.builder(); if (computedStatistics.containsKey(MIN)) { Block block = computedStatistics.get(MIN); if (!block.isNull(0)) { result.setLowValue(getMinMaxAsMetastoreValue(session, timeZone, columnType, block)); } } if (computedStatistics.containsKey(MAX)) { Block block = computedStatistics.get(MAX); if (!block.isNull(0)) { result.setHighValue(getMinMaxAsMetastoreValue(session, timeZone, columnType, block)); } } if (computedStatistics.containsKey(NUMBER_OF_DISTINCT_VALUES)) { result.setDistinctValuesCount(BigintType.BIGINT.getLong(computedStatistics.get(NUMBER_OF_DISTINCT_VALUES), 0)); } if (computedStatistics.containsKey(MAX_VALUE_SIZE_IN_BYTES)) { result.setMaxColumnLength(BigintType.BIGINT.getLong(computedStatistics.get(MAX_VALUE_SIZE_IN_BYTES), 0)); } if (computedStatistics.containsKey(AVERAGE_VALUE_SIZE_IN_BYTES)) { result.setAverageColumnLength(DOUBLE.getDouble(computedStatistics.get(AVERAGE_VALUE_SIZE_IN_BYTES), 0)); } if (computedStatistics.containsKey(NUMBER_OF_NON_NULL_VALUES)) { result.setNullsCount(rowCount - BigintType.BIGINT.getLong(computedStatistics.get(NUMBER_OF_NON_NULL_VALUES), 0)); } if (computedStatistics.containsKey(NUMBER_OF_TRUE_VALUES)) { long numberOfTrue = BigintType.BIGINT.getLong(computedStatistics.get(NUMBER_OF_TRUE_VALUES), 0); result.setTrueCount(numberOfTrue); if (computedStatistics.containsKey(NUMBER_OF_NON_NULL_VALUES)) { long numberOfNonNullValues = BigintType.BIGINT.getLong(computedStatistics.get(NUMBER_OF_NON_NULL_VALUES), 0); result.setFalseCount(numberOfNonNullValues - numberOfTrue); } } return result.build(); }