use of io.crate.types.FixedWidthType in project crate by crate.
the class Stats method estimateSizeForColumns.
public long estimateSizeForColumns(List<Symbol> toCollect) {
long sum = 0L;
for (int i = 0; i < toCollect.size(); i++) {
Symbol symbol = toCollect.get(i);
ColumnStats<?> columnStats = null;
if (symbol instanceof Reference) {
columnStats = statsByColumn.get(((Reference) symbol).column());
} else if (symbol instanceof ScopedSymbol) {
columnStats = statsByColumn.get(((ScopedSymbol) symbol).column());
}
if (columnStats == null) {
if (symbol.valueType() instanceof FixedWidthType) {
sum += ((FixedWidthType) symbol.valueType()).fixedSize();
} else {
sum += RamUsageEstimator.UNKNOWN_DEFAULT_RAM_BYTES_USED;
}
} else {
sum += columnStats.averageSizeInBytes();
}
}
return sum;
}
Aggregations