Search in sources :

Example 1 with TpcdsColumnHandle

use of io.trino.plugin.tpcds.TpcdsColumnHandle in project trino by trinodb.

the class TpcdsTableStatisticsFactory method toTableStatistics.

private TableStatistics toTableStatistics(Map<String, ColumnHandle> columnHandles, TableStatisticsData statisticsData) {
    long rowCount = statisticsData.getRowCount();
    TableStatistics.Builder tableStatistics = TableStatistics.builder().setRowCount(Estimate.of(rowCount));
    if (rowCount > 0) {
        Map<String, ColumnStatisticsData> columnsData = statisticsData.getColumns();
        for (Map.Entry<String, ColumnHandle> entry : columnHandles.entrySet()) {
            TpcdsColumnHandle columnHandle = (TpcdsColumnHandle) entry.getValue();
            tableStatistics.setColumnStatistics(entry.getValue(), toColumnStatistics(columnsData.get(entry.getKey()), columnHandle.getType(), rowCount));
        }
    }
    return tableStatistics.build();
}
Also used : ColumnHandle(io.trino.spi.connector.ColumnHandle) TpcdsColumnHandle(io.trino.plugin.tpcds.TpcdsColumnHandle) TpcdsColumnHandle(io.trino.plugin.tpcds.TpcdsColumnHandle) TableStatistics(io.trino.spi.statistics.TableStatistics) Map(java.util.Map)

Aggregations

TpcdsColumnHandle (io.trino.plugin.tpcds.TpcdsColumnHandle)1 ColumnHandle (io.trino.spi.connector.ColumnHandle)1 TableStatistics (io.trino.spi.statistics.TableStatistics)1 Map (java.util.Map)1