aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorstanly <stanly@yandex-team.com>2023-04-07 19:02:46 +0300
committerstanly <stanly@yandex-team.com>2023-04-07 19:02:46 +0300
commit262c15b53fe9cc3a5cf3a2b859ccf81e19d91f41 (patch)
tree6298b7646abe60aafab252dc89d28ba25eedee42
parentc380bc59f03b81aa0c557d43f2e437a8ba01e443 (diff)
downloadydb-262c15b53fe9cc3a5cf3a2b859ccf81e19d91f41.tar.gz
replace hashmap::count with hashmap::contains
In general, contains() will be faster than count()
-rw-r--r--ydb/core/tx/columnshard/blob_cache.cpp2
-rw-r--r--ydb/core/tx/columnshard/blob_manager.cpp20
-rw-r--r--ydb/core/tx/columnshard/columnshard.cpp2
-rw-r--r--ydb/core/tx/columnshard/columnshard__export.cpp2
-rw-r--r--ydb/core/tx/columnshard/columnshard__scan.cpp6
-rw-r--r--ydb/core/tx/columnshard/columnshard__write_index.cpp10
-rw-r--r--ydb/core/tx/columnshard/columnshard_common.cpp2
-rw-r--r--ydb/core/tx/columnshard/columnshard_impl.cpp2
-rw-r--r--ydb/core/tx/columnshard/columnshard_private_events.h4
-rw-r--r--ydb/core/tx/columnshard/columnshard_ut_common.cpp4
-rw-r--r--ydb/core/tx/columnshard/compaction_actor.cpp4
-rw-r--r--ydb/core/tx/columnshard/engines/column_engine_logs.cpp74
-rw-r--r--ydb/core/tx/columnshard/engines/column_engine_logs.h6
-rw-r--r--ydb/core/tx/columnshard/engines/index_info.cpp2
-rw-r--r--ydb/core/tx/columnshard/engines/index_info.h2
-rw-r--r--ydb/core/tx/columnshard/engines/insert_table.cpp6
-rw-r--r--ydb/core/tx/columnshard/engines/insert_table.h2
-rw-r--r--ydb/core/tx/columnshard/engines/portion_info.cpp6
-rw-r--r--ydb/core/tx/columnshard/engines/portion_info.h10
-rw-r--r--ydb/core/tx/columnshard/eviction_actor.cpp4
-rw-r--r--ydb/core/tx/columnshard/export_actor.cpp2
-rw-r--r--ydb/core/tx/columnshard/indexing_actor.cpp4
-rw-r--r--ydb/core/tx/columnshard/inflight_request_tracker.h4
-rw-r--r--ydb/core/tx/columnshard/read_actor.cpp8
-rw-r--r--ydb/core/tx/columnshard/tables_manager.cpp6
-rw-r--r--ydb/core/tx/columnshard/ut_rw/ut_columnshard_read_write.cpp26
26 files changed, 110 insertions, 110 deletions
diff --git a/ydb/core/tx/columnshard/blob_cache.cpp b/ydb/core/tx/columnshard/blob_cache.cpp
index 250cdf1719b..9451060b18c 100644
--- a/ydb/core/tx/columnshard/blob_cache.cpp
+++ b/ydb/core/tx/columnshard/blob_cache.cpp
@@ -279,7 +279,7 @@ private:
Adds->Inc();
- if (OutstandingReads.count(blobRange)) {
+ if (OutstandingReads.contains(blobRange)) {
// Don't bother if there is already a read request for this range
return;
}
diff --git a/ydb/core/tx/columnshard/blob_manager.cpp b/ydb/core/tx/columnshard/blob_manager.cpp
index 3c5b04c0bb3..db33d71e5fc 100644
--- a/ydb/core/tx/columnshard/blob_manager.cpp
+++ b/ydb/core/tx/columnshard/blob_manager.cpp
@@ -191,7 +191,7 @@ bool TBlobManager::LoadState(IBlobManagerDb& db) {
// Keep + DontKeep (probably in different gen:steps)
// GC could go through it to a greater LastCollectedGenStep
- if (BlobsToDelete.count(blobId)) {
+ if (BlobsToDelete.contains(blobId)) {
continue;
}
@@ -317,7 +317,7 @@ THashMap<ui32, std::unique_ptr<TEvBlobStorage::TEvCollectGarbage>> TBlobManager:
ui32 blobGroup = TabletInfo->GroupFor(blobIt->Channel(), blobIt->Generation());
TGCLists& gl = PerGroupGCListsInFlight[blobGroup];
bool skipDontKeep = false;
- if (gl.KeepList.count(*blobIt)) {
+ if (gl.KeepList.contains(*blobIt)) {
// Remove the blob from keep list if its also in the delete list
gl.KeepList.erase(*blobIt);
// Skipped blobs still need to be deleted from BlobsToKeep table
@@ -395,7 +395,7 @@ void TBlobManager::OnGCResult(TEvBlobStorage::TEvCollectGarbageResult::TPtr ev,
// Find the group for this result
ui64 counterFromRequest = ev->Get()->PerGenerationCounter;
- Y_VERIFY(CounterToGroupInFlight.count(counterFromRequest));
+ Y_VERIFY(CounterToGroupInFlight.contains(counterFromRequest));
ui32 group = CounterToGroupInFlight[counterFromRequest];
auto it = PerGroupGCListsInFlight.find(group);
@@ -495,7 +495,7 @@ void TBlobManager::DeleteBlob(const TUnifiedBlobId& blobId, IBlobManagerDb& db)
++CountersUpdate.BlobsDeleted;
if (blobId.IsSmallBlob()) {
- if (BlobsUseCount.count(blobId) == 0) {
+ if (BlobsUseCount.contains(blobId) == 0) {
DeleteSmallBlob(blobId, db);
} else {
LOG_S_DEBUG("BlobManager at tablet " << TabletInfo->TabletID << " Delay Delete Small Blob " << blobId);
@@ -510,7 +510,7 @@ void TBlobManager::DeleteBlob(const TUnifiedBlobId& blobId, IBlobManagerDb& db)
// Check if the deletion needs to be delayed until the blob is no longer
// used by in-flight requests
- if (BlobsUseCount.count(blobId) == 0) {
+ if (BlobsUseCount.contains(blobId) == 0) {
LOG_S_DEBUG("BlobManager at tablet " << TabletInfo->TabletID << " Delete Blob " << blobId);
TLogoBlobID logoBlobId = blobId.GetLogoBlobId();
BlobsToDelete.insert(logoBlobId);
@@ -524,7 +524,7 @@ void TBlobManager::DeleteBlob(const TUnifiedBlobId& blobId, IBlobManagerDb& db)
bool TBlobManager::ExportOneToOne(TEvictedBlob&& evict, const NKikimrTxColumnShard::TEvictMetadata& meta,
IBlobManagerDb& db)
{
- if (EvictedBlobs.count(evict) || DroppedEvictedBlobs.count(evict)) {
+ if (EvictedBlobs.contains(evict) || DroppedEvictedBlobs.contains(evict)) {
return false;
}
@@ -564,7 +564,7 @@ bool TBlobManager::UpdateOneToOne(TEvictedBlob&& evict, IBlobManagerDb& db, bool
bool extracted = ExtractEvicted(old, meta);
dropped = false;
if (!extracted) {
- dropped = DroppedEvictedBlobs.count(evict);
+ dropped = DroppedEvictedBlobs.contains(evict);
if (!dropped) {
return false; // update after erase
}
@@ -684,7 +684,7 @@ void TBlobManager::PerformDelayedDeletes(IBlobManagerDb& db) {
}
bool TBlobManager::BlobInUse(const NOlap::TUnifiedBlobId& blobId) const {
- return BlobsUseCount.count(blobId);
+ return BlobsUseCount.contains(blobId);
}
void TBlobManager::SetBlobInUse(const TUnifiedBlobId& blobId, bool inUse) {
@@ -723,7 +723,7 @@ void TBlobManager::SetBlobInUse(const TUnifiedBlobId& blobId, bool inUse) {
bool TBlobManager::ExtractEvicted(TEvictedBlob& evict, TEvictMetadata& meta, bool fromDropped /*= false*/) {
if (fromDropped) {
- if (DroppedEvictedBlobs.count(evict)) {
+ if (DroppedEvictedBlobs.contains(evict)) {
auto node = DroppedEvictedBlobs.extract(evict);
if (!node.empty()) {
evict = node.key();
@@ -732,7 +732,7 @@ bool TBlobManager::ExtractEvicted(TEvictedBlob& evict, TEvictMetadata& meta, boo
}
}
} else {
- if (EvictedBlobs.count(evict)) {
+ if (EvictedBlobs.contains(evict)) {
auto node = EvictedBlobs.extract(evict);
if (!node.empty()) {
evict = node.key();
diff --git a/ydb/core/tx/columnshard/columnshard.cpp b/ydb/core/tx/columnshard/columnshard.cpp
index 20033b28c87..c191d59aa70 100644
--- a/ydb/core/tx/columnshard/columnshard.cpp
+++ b/ydb/core/tx/columnshard/columnshard.cpp
@@ -115,7 +115,7 @@ void TColumnShard::Handle(TEvPrivate::TEvReadFinished::TPtr& ev, const TActorCon
InFlightReadsTracker.RemoveInFlightRequest(ev->Get()->RequestCookie, *BlobManager);
ui64 txId = ev->Get()->TxId;
- if (ScanTxInFlight.count(txId)) {
+ if (ScanTxInFlight.contains(txId)) {
TDuration duration = TAppData::TimeProvider->Now() - ScanTxInFlight[txId];
IncCounter(COUNTER_SCAN_LATENCY, duration);
ScanTxInFlight.erase(txId);
diff --git a/ydb/core/tx/columnshard/columnshard__export.cpp b/ydb/core/tx/columnshard/columnshard__export.cpp
index 92ee25ad993..a6e98bc1a37 100644
--- a/ydb/core/tx/columnshard/columnshard__export.cpp
+++ b/ydb/core/tx/columnshard/columnshard__export.cpp
@@ -42,7 +42,7 @@ bool TTxExportFinish::Execute(TTransactionContext& txc, const TActorContext&) {
Y_VERIFY(externId.IsS3Blob());
bool dropped = false;
- if (!msg.Blobs.count(blobId)) {
+ if (!msg.Blobs.contains(blobId)) {
Y_VERIFY(!msg.ErrorStrings.empty());
continue; // not exported
}
diff --git a/ydb/core/tx/columnshard/columnshard__scan.cpp b/ydb/core/tx/columnshard/columnshard__scan.cpp
index 648e6b0179e..c3b063eb5fb 100644
--- a/ydb/core/tx/columnshard/columnshard__scan.cpp
+++ b/ydb/core/tx/columnshard/columnshard__scan.cpp
@@ -139,7 +139,7 @@ private:
if (ranges.size()) {
auto& externBlobs = ReadMetadataRanges[ReadMetadataIndex]->ExternBlobs;
for (auto&& i : ranges) {
- bool fallback = externBlobs && externBlobs->count(i.first);
+ bool fallback = externBlobs && externBlobs->contains(i.first);
NBlobCache::TReadBlobRangeOptions readOpts{
.CacheAfterRead = true,
.ForceFallback = fallback,
@@ -789,7 +789,7 @@ PrepareStatsReadMetadata(ui64 tabletId, const TReadDescription& read, const std:
}
for (ui32 colId : readColumnIds) {
- if (!PrimaryIndexStatsSchema.Columns.count(colId)) {
+ if (!PrimaryIndexStatsSchema.Columns.contains(colId)) {
error = Sprintf("Columnd id %" PRIu32 " not found", colId);
return {};
}
@@ -826,7 +826,7 @@ PrepareStatsReadMetadata(ui64 tabletId, const TReadDescription& read, const std:
const auto& stats = index->GetStats();
if (read.TableName.EndsWith(NOlap::TIndexInfo::TABLE_INDEX_STATS_TABLE)) {
- if (fromPathId <= read.PathId && toPathId >= read.PathId && stats.count(read.PathId)) {
+ if (fromPathId <= read.PathId && toPathId >= read.PathId && stats.contains(read.PathId)) {
out->IndexStats[read.PathId] = std::make_shared<NOlap::TColumnEngineStats>(*stats.at(read.PathId));
}
} else if (read.TableName.EndsWith(NOlap::TIndexInfo::STORE_INDEX_STATS_TABLE)) {
diff --git a/ydb/core/tx/columnshard/columnshard__write_index.cpp b/ydb/core/tx/columnshard/columnshard__write_index.cpp
index 8ddfd4e2965..a9bffb34d7d 100644
--- a/ydb/core/tx/columnshard/columnshard__write_index.cpp
+++ b/ydb/core/tx/columnshard/columnshard__write_index.cpp
@@ -141,7 +141,7 @@ bool TTxWriteIndex::Execute(TTransactionContext& txc, const TActorContext& ctx)
for (auto& rec : portionInfo.Records) {
auto& blobId = rec.BlobRange.BlobId;
- if (!blobsToExport.count(blobId)) {
+ if (!blobsToExport.contains(blobId)) {
NKikimrTxColumnShard::TEvictMetadata meta;
meta.SetTierName(tierName);
@@ -167,11 +167,11 @@ bool TTxWriteIndex::Execute(TTransactionContext& txc, const TActorContext& ctx)
THashSet<TUnifiedBlobId> blobsToDrop;
for (const auto& rec : changes->EvictedRecords) {
const auto& blobId = rec.BlobRange.BlobId;
- if (blobsToExport.count(blobId)) {
+ if (blobsToExport.contains(blobId)) {
// Eviction to S3. TTxExportFinish will delete src blob when dst blob get EEvictState::EXTERN state.
- } else if (!protectedBlobs.count(blobId)) {
+ } else if (!protectedBlobs.contains(blobId)) {
// We could drop the blob immediately
- if (!blobsToDrop.count(blobId)) {
+ if (!blobsToDrop.contains(blobId)) {
LOG_S_TRACE("Delete evicted blob '" << blobId.ToStringNew() << "' at tablet " << Self->TabletID());
blobsToDrop.insert(blobId);
}
@@ -183,7 +183,7 @@ bool TTxWriteIndex::Execute(TTransactionContext& txc, const TActorContext& ctx)
for (const auto& portionInfo : changes->PortionsToDrop) {
for (const auto& rec : portionInfo.Records) {
const auto& blobId = rec.BlobRange.BlobId;
- if (!blobsToDrop.count(blobId)) {
+ if (!blobsToDrop.contains(blobId)) {
LOG_S_TRACE("Delete blob '" << blobId.ToStringNew() << "' at tablet " << Self->TabletID());
blobsToDrop.insert(blobId);
}
diff --git a/ydb/core/tx/columnshard/columnshard_common.cpp b/ydb/core/tx/columnshard/columnshard_common.cpp
index b49a536e200..7b163d6170b 100644
--- a/ydb/core/tx/columnshard/columnshard_common.cpp
+++ b/ydb/core/tx/columnshard/columnshard_common.cpp
@@ -91,7 +91,7 @@ TAssign MakeFunction(const TContext& info, const std::string& name,
};
auto mkLikeOptions = [&](bool ignoreCase) {
- if (arguments.size() != 2 || !info.Constants.count(arguments[1])) {
+ if (arguments.size() != 2 || !info.Constants.contains(arguments[1])) {
return std::shared_ptr<arrow::compute::MatchSubstringOptions>();
}
auto patternScalar = info.Constants[arguments[1]];
diff --git a/ydb/core/tx/columnshard/columnshard_impl.cpp b/ydb/core/tx/columnshard/columnshard_impl.cpp
index 78932bcaf05..3acaa70ec87 100644
--- a/ydb/core/tx/columnshard/columnshard_impl.cpp
+++ b/ydb/core/tx/columnshard/columnshard_impl.cpp
@@ -63,7 +63,7 @@ bool ValidateTableSchema(const NKikimrSchemeOp::TColumnTableSchema& schema) {
TString name = column.GetName();
keyColumns.erase(name);
- if (name == firstKeyColumn && !supportedTypes.count(column.GetTypeId())) {
+ if (name == firstKeyColumn && !supportedTypes.contains(column.GetTypeId())) {
return false;
}
}
diff --git a/ydb/core/tx/columnshard/columnshard_private_events.h b/ydb/core/tx/columnshard/columnshard_private_events.h
index b614ca9d7ac..c5dbd88e8b0 100644
--- a/ydb/core/tx/columnshard/columnshard_private_events.h
+++ b/ydb/core/tx/columnshard/columnshard_private_events.h
@@ -166,8 +166,8 @@ struct TEvPrivate {
Status = NKikimrProto::ERROR;
Y_VERIFY(ErrorStrings.emplace(key, errStr).second, "%s", key.data());
Blobs.erase(blobId);
- } else if (!ErrorStrings.count(key)) { // (OK + !OK) == !OK
- Y_VERIFY(Blobs.count(blobId));
+ } else if (!ErrorStrings.contains(key)) { // (OK + !OK) == !OK
+ Y_VERIFY(Blobs.contains(blobId));
if (Status == NKikimrProto::UNKNOWN) {
Status = NKikimrProto::OK;
}
diff --git a/ydb/core/tx/columnshard/columnshard_ut_common.cpp b/ydb/core/tx/columnshard/columnshard_ut_common.cpp
index f7875b89120..26e1415199b 100644
--- a/ydb/core/tx/columnshard/columnshard_ut_common.cpp
+++ b/ydb/core/tx/columnshard/columnshard_ut_common.cpp
@@ -189,7 +189,7 @@ void PlanCommit(TTestBasicRuntime& runtime, TActorId& sender, ui64 planStep, con
UNIT_ASSERT(event);
auto& res = Proto(event);
- UNIT_ASSERT(txIds.count(res.GetTxId()));
+ UNIT_ASSERT(txIds.contains(res.GetTxId()));
UNIT_ASSERT_EQUAL(res.GetStatus(), NKikimrTxColumnShard::EResultStatus::SUCCESS);
}
}
@@ -245,7 +245,7 @@ TString MakeTestBlob(std::pair<ui64, ui64> range, const TVector<std::pair<TStrin
TVector<ui32> nullPositions;
for (size_t i = 0; i < columns.size(); ++i) {
- if (nullColumns.count(columns[i].first)) {
+ if (nullColumns.contains(columns[i].first)) {
nullPositions.push_back(i);
}
}
diff --git a/ydb/core/tx/columnshard/compaction_actor.cpp b/ydb/core/tx/columnshard/compaction_actor.cpp
index 66028849159..2635bf9de58 100644
--- a/ydb/core/tx/columnshard/compaction_actor.cpp
+++ b/ydb/core/tx/columnshard/compaction_actor.cpp
@@ -38,7 +38,7 @@ public:
Y_VERIFY(blobId == blobRange.BlobId);
Blobs[blobRange] = {};
}
- SendReadRequest(std::move(ranges), event.Externals.count(blobId));
+ SendReadRequest(std::move(ranges), event.Externals.contains(blobId));
}
}
@@ -48,7 +48,7 @@ public:
auto& event = *ev->Get();
const TBlobRange& blobId = event.BlobRange;
- Y_VERIFY(Blobs.count(blobId));
+ Y_VERIFY(Blobs.contains(blobId));
if (!Blobs[blobId].empty()) {
return;
}
diff --git a/ydb/core/tx/columnshard/engines/column_engine_logs.cpp b/ydb/core/tx/columnshard/engines/column_engine_logs.cpp
index 73b5e83a3f4..6c275279c24 100644
--- a/ydb/core/tx/columnshard/engines/column_engine_logs.cpp
+++ b/ydb/core/tx/columnshard/engines/column_engine_logs.cpp
@@ -248,7 +248,7 @@ bool InitInGranuleMerge(const TMark& granuleMark, TVector<TPortionInfo>& portion
++countInBucket;
ui64 prevIsGood = isGood;
- isGood = goodCompacted.count(currentPortion);
+ isGood = goodCompacted.contains(currentPortion);
if (prevIsGood && !isGood) {
nextToGood.insert(currentPortion);
}
@@ -294,14 +294,14 @@ bool InitInGranuleMerge(const TMark& granuleMark, TVector<TPortionInfo>& portion
ui64 curPortion = portionInfo.Portion();
// Prevent merge of compacted portions with no intersections
- if (filtered.count(curPortion)) {
+ if (filtered.contains(curPortion)) {
auto start = portionInfo.PkStart();
Y_VERIFY(start);
borders.emplace_back(TMark(start));
} else {
// nextToGood borders potentially split good compacted portions into 2 parts:
// the first one without intersections and the second with them
- if (goodCompacted.count(curPortion) || nextToGood.count(curPortion)) {
+ if (goodCompacted.contains(curPortion) || nextToGood.contains(curPortion)) {
auto start = portionInfo.PkStart();
Y_VERIFY(start);
borders.emplace_back(TMark(start));
@@ -479,10 +479,10 @@ void TColumnEngineForLogs::UpdatePortionStats(const TPortionInfo& portionInfo, E
ui64 granule = portionInfo.Granule();
Y_VERIFY(granule);
- Y_VERIFY(Granules.count(granule));
+ Y_VERIFY(Granules.contains(granule));
ui64 pathId = Granules[granule]->PathId();
Y_VERIFY(pathId);
- if (!PathStats.count(pathId)) {
+ if (!PathStats.contains(pathId)) {
auto& stats = PathStats[pathId];
stats = std::make_shared<TColumnEngineStats>();
stats->Tables = 1;
@@ -624,14 +624,14 @@ bool TColumnEngineForLogs::Load(IDbWrapper& db, THashSet<TUnifiedBlobId>& lostBl
for (auto& pathId : emptyGranulePaths) {
for (auto& emptyGranules : EmptyGranuleTracks(pathId)) {
// keep first one => megre, keep nothing => drop.
- bool keepFirst = !pathsToDrop.count(pathId);
+ bool keepFirst = !pathsToDrop.contains(pathId);
for (auto& [mark, granule] : emptyGranules) {
if (keepFirst) {
keepFirst = false;
continue;
}
- Y_VERIFY(Granules.count(granule));
+ Y_VERIFY(Granules.contains(granule));
auto spg = Granules[granule];
Y_VERIFY(spg);
GranulesTable->Erase(db, spg->Record);
@@ -696,12 +696,12 @@ std::shared_ptr<TColumnEngineChanges> TColumnEngineForLogs::StartInsert(TVector<
for (auto& data : changes->DataToIndex) {
ui64 pathId = data.PathId;
- if (changes->PathToGranule.count(pathId)) {
+ if (changes->PathToGranule.contains(pathId)) {
continue;
}
- if (PathGranules.count(pathId)) {
- if (PathsGranulesOverloaded.count(pathId)) {
+ if (PathGranules.contains(pathId)) {
+ if (PathsGranulesOverloaded.contains(pathId)) {
return {};
}
@@ -753,11 +753,11 @@ std::shared_ptr<TColumnEngineChanges> TColumnEngineForLogs::StartCompaction(std:
}
}
- Y_VERIFY(Granules.count(granule));
+ Y_VERIFY(Granules.contains(granule));
auto& spg = Granules[granule];
Y_VERIFY(spg);
ui64 pathId = spg->Record.PathId;
- Y_VERIFY(PathGranules.count(pathId));
+ Y_VERIFY(PathGranules.contains(pathId));
for (const auto& [mark, pathGranule] : PathGranules[pathId]) {
if (pathGranule == granule) {
@@ -790,13 +790,13 @@ std::shared_ptr<TColumnEngineChanges> TColumnEngineForLogs::StartCleanup(const T
THashSet<ui64> dropPortions;
THashSet<ui64> emptyPaths;
for (ui64 pathId : pathsToDrop) {
- if (!PathGranules.count(pathId)) {
+ if (!PathGranules.contains(pathId)) {
emptyPaths.insert(pathId);
continue;
}
for (const auto& [_, granule]: PathGranules[pathId]) {
- Y_VERIFY(Granules.count(granule));
+ Y_VERIFY(Granules.contains(granule));
auto spg = Granules[granule];
Y_VERIFY(spg);
for (auto& [portion, info] : spg->Portions) {
@@ -831,7 +831,7 @@ std::shared_ptr<TColumnEngineChanges> TColumnEngineForLogs::StartCleanup(const T
bool isClean = true;
for (auto& [portion, info] : spg->Portions) {
- if (info.IsActive() || dropPortions.count(portion)) {
+ if (info.IsActive() || dropPortions.contains(portion)) {
continue;
}
@@ -877,7 +877,7 @@ std::shared_ptr<TColumnEngineChanges> TColumnEngineForLogs::StartTtl(const THash
bool allowDrop = true;
for (auto& [pathId, ttl] : pathEviction) {
- if (!PathGranules.count(pathId)) {
+ if (!PathGranules.contains(pathId)) {
continue; // It's not an error: allow TTL over multiple shards with different pathIds presented
}
@@ -946,13 +946,13 @@ std::shared_ptr<TColumnEngineChanges> TColumnEngineForLogs::StartTtl(const THash
}
TVector<TVector<std::pair<TMark, ui64>>> TColumnEngineForLogs::EmptyGranuleTracks(ui64 pathId) const {
- Y_VERIFY(PathGranules.count(pathId));
+ Y_VERIFY(PathGranules.contains(pathId));
const auto& pathGranules = PathGranules.find(pathId)->second;
TVector<TVector<std::pair<TMark, ui64>>> emptyGranules;
ui64 emptyStart = 0;
for (const auto& [mark, granule]: pathGranules) {
- Y_VERIFY(Granules.count(granule));
+ Y_VERIFY(Granules.contains(granule));
auto spg = Granules.find(granule)->second;
Y_VERIFY(spg);
@@ -987,7 +987,7 @@ void TColumnEngineForLogs::UpdateOverloaded(const THashMap<ui64, std::shared_ptr
if (size >= Limits.GranuleOverloadSize) {
PathsGranulesOverloaded.emplace(pathId, granule);
- } else if (PathsGranulesOverloaded.count(pathId)) {
+ } else if (PathsGranulesOverloaded.contains(pathId)) {
auto& granules = PathsGranulesOverloaded[pathId];
granules.erase(granule);
if (granules.empty()) {
@@ -1026,7 +1026,7 @@ bool TColumnEngineForLogs::ApplyChanges(IDbWrapper& db, std::shared_ptr<TColumnE
}
for (auto& [_, id] : changes->PortionsToMove) {
- Y_VERIFY(granuleRemap.count(id));
+ Y_VERIFY(granuleRemap.contains(id));
id = granuleRemap[id];
}
@@ -1127,7 +1127,7 @@ bool TColumnEngineForLogs::ApplyChanges(IDbWrapper& db, const TChanges& changes,
Y_VERIFY(!portionInfo.IsActive());
ui64 granule = portionInfo.Granule();
- if (!Granules.count(granule)) {
+ if (!Granules.contains(granule)) {
LOG_S_ERROR("Cannot update portion " << portionInfo << " with unknown granule at tablet " << TabletId);
return false;
}
@@ -1168,7 +1168,7 @@ bool TColumnEngineForLogs::ApplyChanges(IDbWrapper& db, const TChanges& changes,
ui64 granule = portionInfo.Granule();
ui64 portion = portionInfo.Portion();
- if (!Granules.count(granule) || !Granules[granule]->Portions.count(portion)) {
+ if (!Granules.contains(granule) || !Granules[granule]->Portions.contains(portion)) {
LOG_S_ERROR("Cannot evict unknown portion " << portionInfo << " at tablet " << TabletId);
return false;
}
@@ -1243,14 +1243,14 @@ bool TColumnEngineForLogs::ApplyChanges(IDbWrapper& db, const TChanges& changes,
if (!apply) {
ui64 granule = portionInfo.Records[0].Granule;
- if (!Granules.count(granule) && !changes.NewGranules.count(granule)) {
+ if (!Granules.contains(granule) && !changes.NewGranules.contains(granule)) {
LOG_S_ERROR("Cannot write portion with unknown granule " << portionInfo << " at tablet " << TabletId);
return false;
}
// granule vs portion minPK
std::shared_ptr<arrow::Scalar> granuleStart;
- if (Granules.count(granule)) {
+ if (Granules.contains(granule)) {
granuleStart = Granules[granule]->Record.Mark;
} else {
granuleStart = changes.NewGranules.find(granule)->second.second.Border;
@@ -1310,11 +1310,11 @@ bool TColumnEngineForLogs::SetGranule(const TGranuleRecord& rec, bool apply) {
TMark mark(rec.Mark);
if (!apply) {
- if (Granules.count(rec.Granule)) {
+ if (Granules.contains(rec.Granule)) {
return false;
}
- if (PathGranules.count(rec.PathId) && PathGranules[rec.PathId].count(mark)) {
+ if (PathGranules.contains(rec.PathId) && PathGranules[rec.PathId].contains(mark)) {
return false;
}
return true;
@@ -1328,8 +1328,8 @@ bool TColumnEngineForLogs::SetGranule(const TGranuleRecord& rec, bool apply) {
}
void TColumnEngineForLogs::EraseGranule(ui64 pathId, ui64 granule, const TMark& mark) {
- Y_VERIFY(PathGranules.count(pathId));
- Y_VERIFY(Granules.count(granule));
+ Y_VERIFY(PathGranules.contains(pathId));
+ Y_VERIFY(Granules.contains(granule));
Granules.erase(granule);
EmptyGranules.erase(granule);
@@ -1366,7 +1366,7 @@ bool TColumnEngineForLogs::ErasePortion(const TPortionInfo& portionInfo, bool ap
ui64 portion = portionInfo.Portion();
if (!apply) {
- if (!Granules.count(granule)) {
+ if (!Granules.contains(granule)) {
return false;
}
return true;
@@ -1374,7 +1374,7 @@ bool TColumnEngineForLogs::ErasePortion(const TPortionInfo& portionInfo, bool ap
auto& spg = Granules[granule];
Y_VERIFY(spg);
- if (spg->Portions.count(portion)) {
+ if (spg->Portions.contains(portion)) {
if (updateStats) {
UpdatePortionStats(spg->Portions[portion], EStatsUpdateType::ERASE);
}
@@ -1407,14 +1407,14 @@ bool TColumnEngineForLogs::CanInsert(const TChanges& changes, const TSnapshot& c
for (auto& portionInfo : changes.AppendedPortions) {
Y_VERIFY(!portionInfo.Empty());
ui64 granule = portionInfo.Granule();
- if (GranulesInSplit.count(granule)) {
+ if (GranulesInSplit.contains(granule)) {
LOG_S_NOTICE("Cannot insert into splitting granule " << granule << " at tablet " << TabletId);
return false;
}
}
// Does insert have already splitted granule?
for (const auto& [pathId, tsGranules] : changes.PathToGranule) {
- if (PathGranules.count(pathId)) {
+ if (PathGranules.contains(pathId)) {
const auto& actualGranules = PathGranules.find(pathId)->second;
size_t expectedSize = tsGranules.size();
if (actualGranules.size() != expectedSize) {
@@ -1428,7 +1428,7 @@ bool TColumnEngineForLogs::CanInsert(const TChanges& changes, const TSnapshot& c
}
TMap<TSnapshot, TVector<ui64>> TColumnEngineForLogs::GetOrderedPortions(ui64 granule, const TSnapshot& snapshot) const {
- Y_VERIFY(Granules.count(granule));
+ Y_VERIFY(Granules.contains(granule));
auto& spg = Granules.find(granule)->second;
Y_VERIFY(spg);
@@ -1458,7 +1458,7 @@ std::shared_ptr<TSelectInfo> TColumnEngineForLogs::Select(ui64 pathId, TSnapshot
std::shared_ptr<TPredicate> from,
std::shared_ptr<TPredicate> to) const {
auto out = std::make_shared<TSelectInfo>();
- if (!PathGranules.count(pathId)) {
+ if (!PathGranules.contains(pathId)) {
return out;
}
@@ -1487,7 +1487,7 @@ std::shared_ptr<TSelectInfo> TColumnEngineForLogs::Select(ui64 pathId, TSnapshot
break;
}
- Y_VERIFY(Granules.count(granule));
+ Y_VERIFY(Granules.contains(granule));
auto& spg = Granules.find(granule)->second;
Y_VERIFY(spg);
auto& portions = spg->Portions;
@@ -1504,7 +1504,7 @@ std::shared_ptr<TSelectInfo> TColumnEngineForLogs::Select(ui64 pathId, TSnapshot
for (auto& rec : portionInfo.Records) {
Y_VERIFY(rec.Valid());
- if (columnIds.count(rec.ColumnId)) {
+ if (columnIds.contains(rec.ColumnId)) {
outPortion.Records.push_back(rec);
}
}
@@ -1560,7 +1560,7 @@ std::unique_ptr<TCompactionInfo> TColumnEngineForLogs::Compact(ui64& lastCompact
while (!CompactionGranules.empty()) {
Y_VERIFY(it != CompactionGranules.end());
ui64 granule = *it;
- Y_VERIFY(Granules.count(granule));
+ Y_VERIFY(Granules.contains(granule));
auto spg = Granules.find(granule)->second;
Y_VERIFY(spg);
diff --git a/ydb/core/tx/columnshard/engines/column_engine_logs.h b/ydb/core/tx/columnshard/engines/column_engine_logs.h
index 71eca591be5..bb366675258 100644
--- a/ydb/core/tx/columnshard/engines/column_engine_logs.h
+++ b/ydb/core/tx/columnshard/engines/column_engine_logs.h
@@ -166,7 +166,7 @@ public:
}
bool AddPathIfNotExists(ui64 pathId) {
- if (PathToGranule.count(pathId)) {
+ if (PathToGranule.contains(pathId)) {
return false;
}
@@ -182,7 +182,7 @@ public:
ui64 SetTmpGranule(ui64 pathId, const TMark& mark) {
Y_VERIFY(pathId == SrcGranule->PathId);
- if (!TmpGranuleIds.count(mark)) {
+ if (!TmpGranuleIds.contains(mark)) {
TmpGranuleIds[mark] = FirstGranuleId;
++FirstGranuleId;
}
@@ -248,7 +248,7 @@ public:
const TIndexInfo& GetIndexInfo() const override { return IndexInfo; }
const THashSet<ui64>* GetOverloadedGranules(ui64 pathId) const override {
- if (PathsGranulesOverloaded.count(pathId)) {
+ if (PathsGranulesOverloaded.contains(pathId)) {
return &PathsGranulesOverloaded.find(pathId)->second;
}
return nullptr;
diff --git a/ydb/core/tx/columnshard/engines/index_info.cpp b/ydb/core/tx/columnshard/engines/index_info.cpp
index c3f12965514..ed031498d56 100644
--- a/ydb/core/tx/columnshard/engines/index_info.cpp
+++ b/ydb/core/tx/columnshard/engines/index_info.cpp
@@ -304,7 +304,7 @@ bool TIndexInfo::AllowTtlOverColumn(const TString& name) const {
if (it == ColumnNames.end()) {
return false;
}
- return MinMaxIdxColumnsIds.count(it->second);
+ return MinMaxIdxColumnsIds.contains(it->second);
}
void TIndexInfo::UpdatePathTiering(THashMap<ui64, NOlap::TTiering>& pathTiering) const {
diff --git a/ydb/core/tx/columnshard/engines/index_info.h b/ydb/core/tx/columnshard/engines/index_info.h
index 90c2d2c4346..8e67436a8da 100644
--- a/ydb/core/tx/columnshard/engines/index_info.h
+++ b/ydb/core/tx/columnshard/engines/index_info.h
@@ -93,7 +93,7 @@ public:
void CheckTtlColumn(const TString& ttlColumn) const {
Y_VERIFY(!ttlColumn.empty());
- Y_VERIFY(MinMaxIdxColumnsIds.count(GetColumnId(ttlColumn)));
+ Y_VERIFY(MinMaxIdxColumnsIds.contains(GetColumnId(ttlColumn)));
}
std::shared_ptr<arrow::Schema> ArrowSchema() const;
diff --git a/ydb/core/tx/columnshard/engines/insert_table.cpp b/ydb/core/tx/columnshard/engines/insert_table.cpp
index f7557619294..448aaf39044 100644
--- a/ydb/core/tx/columnshard/engines/insert_table.cpp
+++ b/ydb/core/tx/columnshard/engines/insert_table.cpp
@@ -8,7 +8,7 @@ namespace NKikimr::NOlap {
bool TInsertTable::Insert(IDbWrapper& dbTable, TInsertedData&& data) {
TWriteId writeId{data.WriteTxId};
- if (Inserted.count(writeId)) {
+ if (Inserted.contains(writeId)) {
return false;
}
@@ -137,7 +137,7 @@ THashSet<TWriteId> TInsertTable::DropPath(IDbWrapper& dbTable, ui64 pathId) {
}
void TInsertTable::EraseCommitted(IDbWrapper& dbTable, const TInsertedData& data) {
- if (!CommittedByPathId.count(data.PathId)) {
+ if (!CommittedByPathId.contains(data.PathId)) {
return;
}
@@ -150,7 +150,7 @@ void TInsertTable::EraseCommitted(IDbWrapper& dbTable, const TInsertedData& data
void TInsertTable::EraseAborted(IDbWrapper& dbTable, const TInsertedData& data) {
TWriteId writeId{data.WriteTxId};
- if (!Aborted.count(writeId)) {
+ if (!Aborted.contains(writeId)) {
return;
}
diff --git a/ydb/core/tx/columnshard/engines/insert_table.h b/ydb/core/tx/columnshard/engines/insert_table.h
index 9a9f4fba6a6..cc8ca69a83c 100644
--- a/ydb/core/tx/columnshard/engines/insert_table.h
+++ b/ydb/core/tx/columnshard/engines/insert_table.h
@@ -129,7 +129,7 @@ public:
const THashMap<ui64, TSet<TInsertedData>>& GetCommitted() const { return CommittedByPathId; }
const THashMap<TWriteId, TInsertedData>& GetAborted() const { return Aborted; }
void SetOverloaded(ui64 pathId, bool overload);
- bool IsOverloaded(ui64 pathId) const { return PathsOverloaded.count(pathId); }
+ bool IsOverloaded(ui64 pathId) const { return PathsOverloaded.contains(pathId); }
bool HasOverloaded() const { return !PathsOverloaded.empty(); }
private:
diff --git a/ydb/core/tx/columnshard/engines/portion_info.cpp b/ydb/core/tx/columnshard/engines/portion_info.cpp
index 80475480293..bda39fe37c8 100644
--- a/ydb/core/tx/columnshard/engines/portion_info.cpp
+++ b/ydb/core/tx/columnshard/engines/portion_info.cpp
@@ -118,7 +118,7 @@ void TPortionInfo::AddMetadata(const TIndexInfo& indexInfo, const std::shared_pt
TString TPortionInfo::GetMetadata(const TColumnRecord& rec) const {
NKikimrTxColumnShard::TIndexColumnMeta meta; // TODO: move proto serialization out of engines folder
- if (Meta.ColumnMeta.count(rec.ColumnId)) {
+ if (Meta.ColumnMeta.contains(rec.ColumnId)) {
const auto& columnMeta = Meta.ColumnMeta.find(rec.ColumnId)->second;
if (auto numRows = columnMeta.NumRows) {
meta.SetNumRows(numRows);
@@ -207,14 +207,14 @@ void TPortionInfo::LoadMetadata(const TIndexInfo& indexInfo, const TColumnRecord
}
std::shared_ptr<arrow::Scalar> TPortionInfo::MinValue(ui32 columnId) const {
- if (!Meta.ColumnMeta.count(columnId)) {
+ if (!Meta.ColumnMeta.contains(columnId)) {
return {};
}
return Meta.ColumnMeta.find(columnId)->second.Min;
}
std::shared_ptr<arrow::Scalar> TPortionInfo::MaxValue(ui32 columnId) const {
- if (!Meta.ColumnMeta.count(columnId)) {
+ if (!Meta.ColumnMeta.contains(columnId)) {
return {};
}
return Meta.ColumnMeta.find(columnId)->second.Max;
diff --git a/ydb/core/tx/columnshard/engines/portion_info.h b/ydb/core/tx/columnshard/engines/portion_info.h
index 8069a7bdb90..ae727f49f89 100644
--- a/ydb/core/tx/columnshard/engines/portion_info.h
+++ b/ydb/core/tx/columnshard/engines/portion_info.h
@@ -124,7 +124,7 @@ struct TPortionInfo {
}
if (!granuleRemap.empty()) {
for (auto& rec : Records) {
- Y_VERIFY(granuleRemap.count(rec.Granule));
+ Y_VERIFY(granuleRemap.contains(rec.Granule));
rec.Granule = granuleRemap.find(rec.Granule)->second;
}
}
@@ -158,7 +158,7 @@ struct TPortionInfo {
std::shared_ptr<arrow::Scalar> PkStart() const {
if (FirstPkColumn) {
- Y_VERIFY(Meta.ColumnMeta.count(FirstPkColumn));
+ Y_VERIFY(Meta.ColumnMeta.contains(FirstPkColumn));
return MinValue(FirstPkColumn);
}
return {};
@@ -166,7 +166,7 @@ struct TPortionInfo {
std::shared_ptr<arrow::Scalar> PkEnd() const {
if (FirstPkColumn) {
- Y_VERIFY(Meta.ColumnMeta.count(FirstPkColumn));
+ Y_VERIFY(Meta.ColumnMeta.contains(FirstPkColumn));
return MaxValue(FirstPkColumn);
}
return {};
@@ -174,7 +174,7 @@ struct TPortionInfo {
ui32 NumRows() const {
if (FirstPkColumn) {
- Y_VERIFY(Meta.ColumnMeta.count(FirstPkColumn));
+ Y_VERIFY(Meta.ColumnMeta.contains(FirstPkColumn));
return Meta.ColumnMeta.find(FirstPkColumn)->second.NumRows;
}
return 0;
@@ -189,7 +189,7 @@ struct TPortionInfo {
}
bool HasMinMax(ui32 columnId) const {
- if (!Meta.ColumnMeta.count(columnId)) {
+ if (!Meta.ColumnMeta.contains(columnId)) {
return false;
}
return Meta.ColumnMeta.find(columnId)->second.HasMinMax();
diff --git a/ydb/core/tx/columnshard/eviction_actor.cpp b/ydb/core/tx/columnshard/eviction_actor.cpp
index 39f116d73b2..e6a588fddcd 100644
--- a/ydb/core/tx/columnshard/eviction_actor.cpp
+++ b/ydb/core/tx/columnshard/eviction_actor.cpp
@@ -36,7 +36,7 @@ public:
Y_VERIFY(blobId == blobRange.BlobId);
Blobs[blobRange] = {};
}
- SendReadRequest(std::move(ranges), event.Externals.count(blobId));
+ SendReadRequest(std::move(ranges), event.Externals.contains(blobId));
}
}
@@ -46,7 +46,7 @@ public:
auto& event = *ev->Get();
const TBlobRange& blobId = event.BlobRange;
- Y_VERIFY(Blobs.count(blobId));
+ Y_VERIFY(Blobs.contains(blobId));
if (!Blobs[blobId].empty()) {
return;
}
diff --git a/ydb/core/tx/columnshard/export_actor.cpp b/ydb/core/tx/columnshard/export_actor.cpp
index 8dff625bf1d..f019aac4bf6 100644
--- a/ydb/core/tx/columnshard/export_actor.cpp
+++ b/ydb/core/tx/columnshard/export_actor.cpp
@@ -42,7 +42,7 @@ public:
TString blobData = event.Data;
Y_VERIFY(blobData.size() == blobId.BlobSize());
- if (!BlobsToRead.count(blobId)) {
+ if (!BlobsToRead.contains(blobId)) {
return;
}
diff --git a/ydb/core/tx/columnshard/indexing_actor.cpp b/ydb/core/tx/columnshard/indexing_actor.cpp
index 5412ba3633c..029de364814 100644
--- a/ydb/core/tx/columnshard/indexing_actor.cpp
+++ b/ydb/core/tx/columnshard/indexing_actor.cpp
@@ -30,7 +30,7 @@ public:
auto& blobsToIndex = indexChanges->DataToIndex;
for (size_t i = 0; i < blobsToIndex.size(); ++i) {
auto& blobId = blobsToIndex[i].BlobId;
- if (indexChanges->CachedBlobs.count(blobId)) {
+ if (indexChanges->CachedBlobs.contains(blobId)) {
continue;
}
@@ -66,7 +66,7 @@ public:
TString blobData = event.Data;
Y_VERIFY(blobData.size() == blobId.BlobSize());
- if (!BlobsToRead.count(blobId)) {
+ if (!BlobsToRead.contains(blobId)) {
return;
}
diff --git a/ydb/core/tx/columnshard/inflight_request_tracker.h b/ydb/core/tx/columnshard/inflight_request_tracker.h
index 72beea01593..de55e0d4694 100644
--- a/ydb/core/tx/columnshard/inflight_request_tracker.h
+++ b/ydb/core/tx/columnshard/inflight_request_tracker.h
@@ -41,7 +41,7 @@ public:
// Forget completed request
void RemoveInFlightRequest(ui64 cookie, IBlobInUseTracker& blobTracker) {
- Y_VERIFY(RequestsMeta.count(cookie), "Unknown request cookie %" PRIu64, cookie);
+ Y_VERIFY(RequestsMeta.contains(cookie), "Unknown request cookie %" PRIu64, cookie);
const auto& readMetaList = RequestsMeta[cookie];
for (const auto& readMetaBase : readMetaList) {
@@ -75,7 +75,7 @@ public:
// Checks if the portion is in use by any in-flight request
bool IsPortionUsed(ui64 portionId) const {
- return PortionUseCount.count(portionId);
+ return PortionUseCount.contains(portionId);
}
NOlap::TSelectInfo::TStats GetSelectStatsDelta() {
diff --git a/ydb/core/tx/columnshard/read_actor.cpp b/ydb/core/tx/columnshard/read_actor.cpp
index 7a0d8095d07..cd7a61320ac 100644
--- a/ydb/core/tx/columnshard/read_actor.cpp
+++ b/ydb/core/tx/columnshard/read_actor.cpp
@@ -46,13 +46,13 @@ public:
Y_VERIFY(event.Data.size() == event.BlobRange.Size, "%zu, %d", event.Data.size(), event.BlobRange.Size);
- if (IndexedBlobs.count(event.BlobRange)) {
- if (!WaitIndexed.count(event.BlobRange)) {
+ if (IndexedBlobs.contains(event.BlobRange)) {
+ if (!WaitIndexed.contains(event.BlobRange)) {
return; // ignore duplicate parts
}
WaitIndexed.erase(event.BlobRange);
IndexedData.AddIndexed(event.BlobRange, event.Data, nullptr);
- } else if (CommittedBlobs.count(blobId)) {
+ } else if (CommittedBlobs.contains(blobId)) {
auto cmt = WaitCommitted.extract(NOlap::TCommittedBlob{blobId, 0, 0});
if (cmt.empty()) {
return; // ignore duplicates
@@ -219,7 +219,7 @@ public:
Y_VERIFY(blobRange.Size);
auto& externBlobs = ReadMetadata->ExternBlobs;
- bool fallback = externBlobs && externBlobs->count(blobRange.BlobId);
+ bool fallback = externBlobs && externBlobs->contains(blobRange.BlobId);
NBlobCache::TReadBlobRangeOptions readOpts {
.CacheAfterRead = true,
diff --git a/ydb/core/tx/columnshard/tables_manager.cpp b/ydb/core/tx/columnshard/tables_manager.cpp
index 6412e3a48e7..c96c4c3d9e2 100644
--- a/ydb/core/tx/columnshard/tables_manager.cpp
+++ b/ydb/core/tx/columnshard/tables_manager.cpp
@@ -30,7 +30,7 @@ bool TTablesManager::InitFromDB(NIceDb::TNiceDb& db, const ui64 tabletId) {
PathsToDrop.insert(table.GetPathId());
}
Tables.insert_or_assign(table.GetPathId(), std::move(table));
-
+
if (!rowset.Next()) {
return false;
}
@@ -231,7 +231,7 @@ void TTablesManager::AddPresetVersion(const ui32 presetId, const TRowVersion& ve
versionInfo.SetSinceStep(version.Step);
versionInfo.SetSinceTxId(version.TxId);
*versionInfo.MutableSchema() = schema;
-
+
auto& schemaPreset = SchemaPresets.at(presetId);
Schema::SaveSchemaPresetVersionInfo(db, presetId, version, versionInfo);
schemaPreset.AddVersion(version, versionInfo);
@@ -305,7 +305,7 @@ NOlap::TIndexInfo TTablesManager::ConvertSchema(const TTableSchema& schema) {
}
for (const auto& keyName : schema.GetKeyColumnNames()) {
- Y_VERIFY(indexInfo.ColumnNames.count(keyName));
+ Y_VERIFY(indexInfo.ColumnNames.contains(keyName));
indexInfo.KeyColumns.push_back(indexInfo.ColumnNames[keyName]);
}
diff --git a/ydb/core/tx/columnshard/ut_rw/ut_columnshard_read_write.cpp b/ydb/core/tx/columnshard/ut_rw/ut_columnshard_read_write.cpp
index fcfe683dde6..eb13dae1819 100644
--- a/ydb/core/tx/columnshard/ut_rw/ut_columnshard_read_write.cpp
+++ b/ydb/core/tx/columnshard/ut_rw/ut_columnshard_read_write.cpp
@@ -119,7 +119,7 @@ bool DataHasOnly(const std::vector<TString>& blobs, const TString& srtSchema, st
return false;
});
- if (!keys.count(value)) {
+ if (!keys.contains(value)) {
Cerr << "Unexpected key: " << value << "\n";
return false;
}
@@ -1666,8 +1666,8 @@ void TestReadAggregate(const TVector<std::pair<TString, TTypeInfo>>& ydbSchema,
ui32 prog = 0;
for (ui32 i = 0; i < ydbSchema.size(); ++i, ++prog) {
- if (intTypes.count(ydbSchema[i].second.GetTypeId()) ||
- strTypes.count(ydbSchema[i].second.GetTypeId())) {
+ if (intTypes.contains(ydbSchema[i].second.GetTypeId()) ||
+ strTypes.contains(ydbSchema[i].second.GetTypeId())) {
checkResult.insert(prog);
}
@@ -1683,8 +1683,8 @@ void TestReadAggregate(const TVector<std::pair<TString, TTypeInfo>>& ydbSchema,
for (ui32 i = 0; i < ydbSchema.size(); ++i, ++prog) {
isFiltered.insert(prog);
- if (intTypes.count(ydbSchema[i].second.GetTypeId()) ||
- strTypes.count(ydbSchema[i].second.GetTypeId())) {
+ if (intTypes.contains(ydbSchema[i].second.GetTypeId()) ||
+ strTypes.contains(ydbSchema[i].second.GetTypeId())) {
checkResult.insert(prog);
}
@@ -1743,8 +1743,8 @@ void TestReadAggregate(const TVector<std::pair<TString, TTypeInfo>>& ydbSchema,
UNIT_ASSERT(batch->ValidateFull().ok());
}
- if (checkResult.count(prog)) {
- if (isFiltered.count(prog)) {
+ if (checkResult.contains(prog)) {
+ if (isFiltered.contains(prog)) {
UNIT_ASSERT(CheckColumns(batch, namedColumns, expectedFiltered.NumRows));
if (aggKeys.empty()) { // TODO: ORDER BY for compare
UNIT_ASSERT(CheckIntValues(batch->GetColumnByName("res_min"), expectedFiltered.MinValues));
@@ -1966,7 +1966,7 @@ Y_UNIT_TEST_SUITE(TColumnShardTestReadWrite) {
Cerr << "-- group by key: " << key << "\n";
// the type has the same values in test batch so result would be grouped in one row
- if (sameValTypes.count(schema[key].second.GetTypeId())) {
+ if (sameValTypes.contains(schema[key].second.GetTypeId())) {
TestReadAggregate(schema, testBlob, (key % 2), {key}, resGrouped, resFiltered);
} else {
TestReadAggregate(schema, testBlob, (key % 2), {key}, resDefault, resFiltered);
@@ -1974,8 +1974,8 @@ Y_UNIT_TEST_SUITE(TColumnShardTestReadWrite) {
}
for (ui32 key = 0; key < schema.size() - 1; ++key) {
Cerr << "-- group by key: " << key << ", " << key + 1 << "\n";
- if (sameValTypes.count(schema[key].second.GetTypeId()) &&
- sameValTypes.count(schema[key + 1].second.GetTypeId())) {
+ if (sameValTypes.contains(schema[key].second.GetTypeId()) &&
+ sameValTypes.contains(schema[key + 1].second.GetTypeId())) {
TestReadAggregate(schema, testBlob, (key % 2), {key, key + 1}, resGrouped, resFiltered);
} else {
TestReadAggregate(schema, testBlob, (key % 2), {key, key + 1}, resDefault, resFiltered);
@@ -1983,9 +1983,9 @@ Y_UNIT_TEST_SUITE(TColumnShardTestReadWrite) {
}
for (ui32 key = 0; key < schema.size() - 2; ++key) {
Cerr << "-- group by key: " << key << ", " << key + 1 << ", " << key + 2 << "\n";
- if (sameValTypes.count(schema[key].second.GetTypeId()) &&
- sameValTypes.count(schema[key + 1].second.GetTypeId()) &&
- sameValTypes.count(schema[key + 1].second.GetTypeId())) {
+ if (sameValTypes.contains(schema[key].second.GetTypeId()) &&
+ sameValTypes.contains(schema[key + 1].second.GetTypeId()) &&
+ sameValTypes.contains(schema[key + 1].second.GetTypeId())) {
TestReadAggregate(schema, testBlob, (key % 2), {key, key + 1, key + 2}, resGrouped, resFiltered);
} else {
TestReadAggregate(schema, testBlob, (key % 2), {key, key + 1, key + 2}, resDefault, resFiltered);