use of com.amazonaws.services.glue.model.DecimalNumber in project alluxio by Alluxio.
the class GlueUtilsTest method protoColStatsWithDecimalData.
@Test
public void protoColStatsWithDecimalData() {
// ColumnStatistics required fields: AnalyzedTime, ColumnName, ColumnType, StatisticsData
ColumnStatistics glueColStats = new ColumnStatistics();
glueColStats.setColumnName("colName");
glueColStats.setColumnType("colType");
ColumnStatisticsData data = new ColumnStatisticsData();
// verify empty data
data.setType("DECIMAL");
glueColStats.setStatisticsData(data);
verifyColumnStats(glueColStats);
// verify non-empty data
DecimalColumnStatisticsData decimalData = new DecimalColumnStatisticsData();
DecimalNumber maxDecimalNumber = new DecimalNumber();
maxDecimalNumber.setScale(mRandom.nextInt());
maxDecimalNumber.setUnscaledValue(ByteBuffer.wrap(CommonUtils.randomBytes(5)));
DecimalNumber minDecimalNumber = new DecimalNumber();
minDecimalNumber.setScale(mRandom.nextInt());
minDecimalNumber.setUnscaledValue(ByteBuffer.wrap(CommonUtils.randomBytes(5)));
decimalData.setMaximumValue(maxDecimalNumber);
decimalData.setMinimumValue(minDecimalNumber);
decimalData.setNumberOfNulls(mRandom.nextLong());
decimalData.setNumberOfDistinctValues(mRandom.nextLong());
data.setDecimalColumnStatisticsData(decimalData);
glueColStats.setStatisticsData(data);
verifyColumnStats(glueColStats);
// verify null column values
decimalData.setMaximumValue(null);
decimalData.setMinimumValue(null);
data.setDecimalColumnStatisticsData(decimalData);
glueColStats.setStatisticsData(data);
verifyColumnStats(glueColStats);
}
Aggregations