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

Function getTypedMinMax

src/storage/compression/compression.cpp:34–54  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

32
33template<typename T>
34auto getTypedMinMax(std::span<const T> data, const NullMask* nullMask, uint64_t nullMaskOffset) {
35 std::optional<StorageValue> min, max;
36 DASSERT(data.size() > 0);
37 if (!nullMask || nullMask->hasNoNullsGuarantee()) {
38 auto [minRaw, maxRaw] = std::minmax_element(data.begin(), data.end());
39 min = StorageValue(*minRaw);
40 max = StorageValue(*maxRaw);
41 } else {
42 for (uint64_t i = 0; i < data.size(); i++) {
43 if (!nullMask->isNull(nullMaskOffset + i)) {
44 if (!min || data[i] < min->get<T>()) {
45 min = StorageValue(data[i]);
46 }
47 if (!max || data[i] > max->get<T>()) {
48 max = StorageValue(data[i]);
49 }
50 }
51 }
52 }
53 return std::make_pair(min, max);
54}
55
56uint32_t getDataTypeSizeInChunk(const common::LogicalType& dataType) {
57 return getDataTypeSizeInChunk(dataType.getPhysicalType());

Callers 1

getMinMaxStorageValueFunction · 0.85

Calls 5

StorageValueFunction · 0.85
sizeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
isNullMethod · 0.45

Tested by

no test coverage detected