Refine search
public StripeStatistics(List<ColumnStatistics> columnStatistics) { this.columnStatistics = ImmutableList.copyOf(requireNonNull(columnStatistics, "columnStatistics is null")); this.retainedSizeInBytes = INSTANCE_SIZE + columnStatistics.stream().mapToLong(ColumnStatistics::getRetainedSizeInBytes).sum(); }
private synchronized void addPages(Collection<SerializedPageReference> pages) { pages.forEach(SerializedPageReference::addReference); this.pages.addAll(pages); long rowCount = pages.stream().mapToLong(SerializedPageReference::getPositionCount).sum(); rowsAdded.addAndGet(rowCount); pagesAdded.addAndGet(pages.size()); long bytesAdded = pages.stream().mapToLong(SerializedPageReference::getRetainedSizeInBytes).sum(); bufferedBytes.addAndGet(bytesAdded); }
public long getTotalPartitionsCount(String keyspace, String table, Optional<Long> sessionSplitsPerNode) { if (sessionSplitsPerNode.isPresent()) { return sessionSplitsPerNode.get(); } else if (configSplitsPerNode.isPresent()) { return configSplitsPerNode.get(); } List<SizeEstimate> estimates = session.getSizeEstimates(keyspace, table); return estimates.stream() .mapToLong(SizeEstimate::getPartitionsCount) .sum(); }
/** * @return The sum of {@link #getTotalActiveConnectionCount()} and {@link #getTotalIdleConnectionCount()}, * a long representing the total number of connections in the connection pool. */ public long getTotalConnectionCount() { return statsPerHost .values() .stream() .mapToLong(HostStats::getHostConnectionCount) .sum(); }
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())); } }