diff options
author | Maksim Kita <kitaetoya@gmail.com> | 2023-06-27 08:45:28 +0000 |
---|---|---|
committer | maksim-kita <maksim-kita@yandex-team.com> | 2023-06-27 11:45:28 +0300 |
commit | b4faefd1b2397e37f40017834caef43cb8f2a450 (patch) | |
tree | 6bcffa7baf709c13c3c8efb457c0c2d200711180 | |
parent | e7f9d2dd4ebb32eb7f9c395173b95ef5f9e08ead (diff) | |
download | ydb-b4faefd1b2397e37f40017834caef43cb8f2a450.tar.gz |
Histogram choose split key small improvement
Histogram choose split key small improvement
Pull Request resolved: #277
-rw-r--r-- | ydb/core/tx/schemeshard/schemeshard__table_stats_histogram.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/ydb/core/tx/schemeshard/schemeshard__table_stats_histogram.cpp b/ydb/core/tx/schemeshard/schemeshard__table_stats_histogram.cpp index 498d65a3f3..4d0292a0e6 100644 --- a/ydb/core/tx/schemeshard/schemeshard__table_stats_histogram.cpp +++ b/ydb/core/tx/schemeshard/schemeshard__table_stats_histogram.cpp @@ -67,16 +67,16 @@ TSerializedCellVec ChooseSplitKeyByHistogram(const NKikimrTableStats::THistogram // For other types let's do binary search between med and hi to find smallest key > med // Compares only i-th cell in keys - auto fnCmpCurrentCell = [i, columnType] (const auto& bucket1, const auto& bucket2) { - TSerializedCellVec key1(bucket1.GetKey()); - TSerializedCellVec key2(bucket2.GetKey()); - return CompareTypedCells(key1.GetCells()[i], key2.GetCells()[i], columnType) < 0; + auto fnCmpCurrentCell = [i, columnType] (const auto& keyMed, const auto& bucket) { + TSerializedCellVec bucketCells(bucket.GetKey()); + return CompareTypedCells(keyMed.GetCells()[i], bucketCells.GetCells()[i], columnType) < 0; }; + const auto bucketsBegin = histogram.GetBuckets().begin(); const auto it = UpperBound( bucketsBegin + idxMed, bucketsBegin + idxHi, - histogram.GetBuckets(idxMed), + keyMed, fnCmpCurrentCell); TSerializedCellVec keyFound(it->GetKey()); splitKey[i] = keyFound.GetCells()[i]; |