diff options
author | ivanmorozov <ivanmorozov@ydb.tech> | 2023-12-07 11:14:14 +0300 |
---|---|---|
committer | ivanmorozov <ivanmorozov@ydb.tech> | 2023-12-07 11:44:43 +0300 |
commit | 74c09c6129bf650153ab8baac051b1ebfe154d0e (patch) | |
tree | 644c9176ad731d5f49ee49783538550bbebeca97 | |
parent | c9acd0d0c5306c53f3e81a780f2217870946be4d (diff) | |
download | ydb-74c09c6129bf650153ab8baac051b1ebfe154d0e.tar.gz |
KIKIMR-19582: dont merge in case fully empty intervals
-rw-r--r-- | ydb/core/tx/columnshard/engines/reader/plain_reader/interval.cpp | 17 | ||||
-rw-r--r-- | ydb/core/tx/columnshard/engines/reader/plain_reader/interval.h | 1 |
2 files changed, 17 insertions, 1 deletions
diff --git a/ydb/core/tx/columnshard/engines/reader/plain_reader/interval.cpp b/ydb/core/tx/columnshard/engines/reader/plain_reader/interval.cpp index 28a82d5e6b..464127ef02 100644 --- a/ydb/core/tx/columnshard/engines/reader/plain_reader/interval.cpp +++ b/ydb/core/tx/columnshard/engines/reader/plain_reader/interval.cpp @@ -42,6 +42,19 @@ private: LastPK = nullptr; } } + + bool EmptyFiltersOnly() const { + for (auto&& [_, i] : Sources) { + if (!i->GetFilterStageData().GetBatch() || !i->GetFilterStageData().GetBatch()->num_rows()) { + continue; + } + auto f = i->GetFilterStageData().GetNotAppliedEarlyFilter(); + if (!f || !f->IsTotalDenyFilter()) { + return false; + } + } + return true; + } protected: virtual bool DoApply(NOlap::IDataReader& indexedDataRead) const override { AFL_DEBUG(NKikimrServices::TX_COLUMNSHARD_SCAN)("event", "DoApply")("interval_idx", MergingContext->GetIntervalIdx()); @@ -66,6 +79,10 @@ protected: AFL_VERIFY(!!LastPK == (!!ResultBatch && ResultBatch->num_rows())); return true; } + if (EmptyFiltersOnly()) { + ResultBatch = NArrow::MakeEmptyBatch(Context->GetProgramInputColumns()->GetSchema()); + return true; + } std::shared_ptr<NIndexedReader::TMergePartialStream> merger = Context->BuildMerger(); for (auto&& [_, i] : Sources) { if (auto rb = i->GetBatch()) { diff --git a/ydb/core/tx/columnshard/engines/reader/plain_reader/interval.h b/ydb/core/tx/columnshard/engines/reader/plain_reader/interval.h index a86845b0fe..50f7fe76a8 100644 --- a/ydb/core/tx/columnshard/engines/reader/plain_reader/interval.h +++ b/ydb/core/tx/columnshard/engines/reader/plain_reader/interval.h @@ -68,7 +68,6 @@ private: return result; } - bool IsSourcesReady(); std::shared_ptr<NResourceBroker::NSubscribe::TResourcesGuard> ResourcesGuard; const ui32 IntervalIdx; TAtomicCounter ReadySourcesCount = 0; |