use of org.apache.flink.table.plan.stats.ColumnStats in project flink by apache.
the class CatalogTableStatisticsConverter method convertToColumnStatsMap.
@VisibleForTesting
public static Map<String, ColumnStats> convertToColumnStatsMap(Map<String, CatalogColumnStatisticsDataBase> columnStatisticsData) {
Map<String, ColumnStats> columnStatsMap = new HashMap<>();
for (Map.Entry<String, CatalogColumnStatisticsDataBase> entry : columnStatisticsData.entrySet()) {
if (entry.getValue() != null) {
ColumnStats columnStats = convertToColumnStats(entry.getValue());
columnStatsMap.put(entry.getKey(), columnStats);
}
}
return columnStatsMap;
}
use of org.apache.flink.table.plan.stats.ColumnStats in project flink by apache.
the class CatalogTableStatisticsConverterTest method testConvertToColumnStatsMapWithNullColumnStatisticsData.
@Test
public void testConvertToColumnStatsMapWithNullColumnStatisticsData() {
Map<String, CatalogColumnStatisticsDataBase> columnStatisticsDataBaseMap = new HashMap<>();
columnStatisticsDataBaseMap.put("first", new CatalogColumnStatisticsDataString(10L, 5.2, 3L, 100L));
columnStatisticsDataBaseMap.put("second", null);
Map<String, ColumnStats> columnStatsMap = CatalogTableStatisticsConverter.convertToColumnStatsMap(columnStatisticsDataBaseMap);
assertNotNull(columnStatsMap);
assertEquals(columnStatisticsDataBaseMap.size() - 1, columnStatsMap.size());
assertTrue(columnStatsMap.containsKey("first"));
assertFalse(columnStatsMap.containsKey("second"));
}
Aggregations