MCPcopy Create free account
hub / github.com/LadybugDB/ladybug / updateStatistics

Method updateStatistics

src/storage/table/column.cpp:329–345  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

327}
328
329void Column::updateStatistics(ColumnChunkMetadata& metadata, offset_t maxIndex,
330 const std::optional<StorageValue>& min, const std::optional<StorageValue>& max) const {
331 if (maxIndex >= metadata.numValues) {
332 metadata.numValues = maxIndex + 1;
333 DASSERT(sanityCheckForWrites(metadata, dataType));
334 }
335 // Either both or neither should be provided
336 DASSERT((!min && !max) || (min && max));
337 if (min && max) {
338 // If new values are outside of the existing min/max, update them
339 if (max->gt(metadata.compMeta.max, dataType.getPhysicalType())) {
340 metadata.compMeta.max = *max;
341 } else if (metadata.compMeta.min.gt(*min, dataType.getPhysicalType())) {
342 metadata.compMeta.min = *min;
343 }
344 }
345}
346
347void Column::write(ColumnChunkData& persistentChunk, ChunkState& state, offset_t initialDstOffset,
348 const ColumnChunkData& data, offset_t srcOffset, length_t numValues) const {

Callers 1

writeSegmentMethod · 0.80

Calls 3

sanityCheckForWritesFunction · 0.85
gtMethod · 0.80
getPhysicalTypeMethod · 0.45

Tested by

no test coverage detected