Skip to content

Commit 443978f

Browse files
committed
review fixes
1 parent 00c0b07 commit 443978f

File tree

3 files changed

+16
-7
lines changed

3 files changed

+16
-7
lines changed

ydb/core/statistics/aggregator/analyze_actor.cpp

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,16 @@ class TCMSEval : public IColumnStatisticEval {
2424
static std::optional<TCMSEval> MaybeCreate(
2525
const NKikimrStat::TSimpleColumnStatistics& simpleStats,
2626
const NScheme::TTypeInfo&) {
27-
if (simpleStats.GetCountDistinct() >= 0.8 * simpleStats.GetCount()) {
27+
if (simpleStats.GetCount() == 0 || simpleStats.GetCountDistinct() == 0) {
28+
// Empty table
2829
return std::nullopt;
2930
}
3031

3132
const double n = simpleStats.GetCount();
3233
const double ndv = simpleStats.GetCountDistinct();
33-
if (ndv == 0) {
34-
return TCMSEval(MIN_WIDTH);
34+
35+
if (ndv >= 0.8 * n) {
36+
return std::nullopt;
3537
}
3638

3739
const double c = 10;
@@ -208,7 +210,7 @@ void TAnalyzeActor::Handle(TEvTxProxySchemeCache::TEvNavigateKeySetResult::TPtr&
208210
for (const auto& colTag : RequestedColumnTags) {
209211
auto colIt = tag2Column.find(colTag);
210212
if (colIt == tag2Column.end()) {
211-
// Column probably already deleted, skip it.
213+
// Column probably already dropped, skip it.
212214
continue;
213215
}
214216
addColumn(colIt->second);
@@ -219,6 +221,14 @@ void TAnalyzeActor::Handle(TEvTxProxySchemeCache::TEvNavigateKeySetResult::TPtr&
219221
}
220222
}
221223

224+
if (Columns.empty()) {
225+
// All requested columns were already dropped. Send empty response right away.
226+
auto response = std::make_unique<TEvStatistics::TEvFinishTraversal>(std::move(Results));
227+
Send(Parent, response.release());
228+
PassAway();
229+
return;
230+
}
231+
222232
Become(&TThis::StateQueryStage1);
223233
auto actor = std::make_unique<TScanActor>(
224234
SelfId(), DatabaseName, stage1Builder.Build(TableName), stage1Builder.ColumnCount());
@@ -263,7 +273,6 @@ void TAnalyzeActor::HandleStage1(TEvPrivate::TEvAnalyzeScanResult::TPtr& ev) {
263273
continue;
264274
}
265275
if (statEval->EstimateSize() >= 4_MB) {
266-
// To avoid: Error: ydb/library/yql/dq/runtime/dq_output_channel.cpp:405: Row data size is too big: 53839241 bytes, exceeds limit of 50331648 bytes
267276
continue;
268277
}
269278
statEval->AddAggregations(col.Name, stage2Builder);

ydb/core/statistics/aggregator/analyze_actor.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ class TAnalyzeActor : public NActors::TActorBootstrapped<TAnalyzeActor> {
5555
, Name(std::move(name))
5656
{}
5757
TColumnDesc(TColumnDesc&&) noexcept = default;
58-
TColumnDesc& operator=(TColumnDesc&) noexcept = default;
58+
TColumnDesc& operator=(TColumnDesc&&) noexcept = default;
5959

6060
NKikimrStat::TSimpleColumnStatistics ExtractSimpleStats(
6161
ui64 count, const TVector<NYdb::TValue>& aggColumns) const;

ydb/core/statistics/service/ut/ut_column_statistics.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ Y_UNIT_TEST_SUITE(ColumnStatistics) {
3434

3535
std::vector<TCountMinSketchProbes> expected = {
3636
{
37-
.Tag = 2, // Key column
37+
.Tag = 2, // Value column
3838
.Probes{ {"1", 100}, {"2", 100} }
3939
}
4040
};

0 commit comments

Comments
 (0)