MCPcopy Create free account
hub / github.com/ByConity/ByConity / insert

Method insert

src/Storages/MergeTree/DeleteBitmapCache.cpp:58–73  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

56DeleteBitmapCache::~DeleteBitmapCache() = default;
57
58void DeleteBitmapCache::insert(const String & key, UInt64 version, ImmutableDeleteBitmapPtr bitmap)
59{
60 if (bitmap == nullptr)
61 throw Exception("bitmap is null", ErrorCodes::BAD_ARGUMENTS);
62
63 /// TODO improve accuracy of memory usage estimation
64 /// Currently we estimate the memory usage of the bitmap to be 2 bytes per elements,
65 /// which may be underestimated for sparse bitmap and overestimated for dense bitmap.
66 size_t charge = sizeof(CachedBitmap) + 2 * (bitmap->cardinality());
67 CachedBitmap * value = new CachedBitmap(version, std::move(bitmap));
68 auto * handle = cache->Insert(key, value, charge, &DeleteCachedBitmap);
69 if (handle)
70 cache->Release(handle);
71 else
72 delete value; /// insert failed
73}
74
75size_t DeleteBitmapCache::totalCharge()
76{

Callers 15

sampleByRangeMethod · 0.45
checkLimitsMethod · 0.45
injectVirtualColumnsImplFunction · 0.45
insertStringColumnMethod · 0.45
insertUInt64ColumnMethod · 0.45
insertInt64ColumnMethod · 0.45
insertUInt8ColumnMethod · 0.45
insertUUIDColumnMethod · 0.45

Calls 3

ExceptionClass · 0.50
InsertMethod · 0.45
ReleaseMethod · 0.45

Tested by

no test coverage detected