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

Function sanityCheckForWrites

src/storage/table/column.cpp:312–327  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

310}
311
312[[maybe_unused]] static bool sanityCheckForWrites(const ColumnChunkMetadata& metadata,
313 const LogicalType& dataType) {
314 if (metadata.compMeta.compression == CompressionType::ALP) {
315 return metadata.compMeta.children.size() != 0;
316 }
317 if (metadata.compMeta.compression == CompressionType::CONSTANT) {
318 return metadata.getNumDataPages(dataType.getPhysicalType()) == 0;
319 }
320 const auto numValuesPerPage = metadata.compMeta.numValues(LBUG_PAGE_SIZE, dataType);
321 if (numValuesPerPage == UINT64_MAX) {
322 return metadata.getNumDataPages(dataType.getPhysicalType()) == 0;
323 }
324 return std::ceil(
325 static_cast<double>(metadata.numValues) / static_cast<double>(numValuesPerPage)) <=
326 metadata.getNumDataPages(dataType.getPhysicalType());
327}
328
329void Column::updateStatistics(ColumnChunkMetadata& metadata, offset_t maxIndex,
330 const std::optional<StorageValue>& min, const std::optional<StorageValue>& max) const {

Callers 1

updateStatisticsMethod · 0.85

Calls 4

sizeMethod · 0.45
getNumDataPagesMethod · 0.45
getPhysicalTypeMethod · 0.45
numValuesMethod · 0.45

Tested by

no test coverage detected