presto-main/src/main/java/io/prestosql/operator/WindowInfo.java/WindowInfo/build
class WindowInfo:        public Optional<IndexInfo> build()
        {
            List<Integer> partitions = partitionsSizes.build();
            if (partitions.size() == 0) {
                return Optional.empty();
            }
            double avgSize = partitions.stream().mapToLong(Integer::longValue).average().getAsDouble();
            double squaredDifferences = partitions.stream().mapToDouble(size -> Math.pow(size - avgSize, 2)).sum();
            checkState(partitions.stream().mapToLong(Integer::longValue).sum() == rowsNumber, "Total number of rows in index does not match number of rows in partitions within that index");

            return Optional.of(new IndexInfo(rowsNumber, sizeInBytes, squaredDifferences, partitions.size()));
        }