Skip to content

Commit

Permalink
switchable slices filter (#12791)
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanmorozov333 authored Dec 19, 2024
1 parent 737b0d5 commit a39dc2a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
1 change: 1 addition & 0 deletions ydb/core/protos/config.proto
Original file line number Diff line number Diff line change
Expand Up @@ -1737,6 +1737,7 @@ message TColumnShardConfig {
optional string ReaderClassName = 28;
optional bool AllowNullableColumnsInPK = 29 [default = false];
optional uint32 RestoreDataOnWriteTimeoutSeconds = 30;
optional bool UseSlicesFilter = 31 [default = true];
}

message TSchemeShardConfig {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#pragma once
#include <ydb/core/base/appdata.h>
#include <ydb/core/formats/arrow/arrow_filter.h>
#include <ydb/core/formats/arrow/common/container.h>
#include <ydb/core/formats/arrow/size_calcer.h>
#include <ydb/core/protos/config.pb.h>
#include <ydb/core/tx/columnshard/blob.h>
#include <ydb/core/tx/columnshard/blobs_reader/task.h>
#include <ydb/core/tx/columnshard/engines/portions/data_accessor.h>
Expand Down Expand Up @@ -146,7 +148,8 @@ class TFetchedData {

void AddFilter(const NArrow::TColumnFilter& filter) {
if (UseFilter && Table) {
AFL_VERIFY(filter.Apply(Table, NArrow::TColumnFilter::TApplyContext().SetTrySlices(true)));
AFL_VERIFY(filter.Apply(Table,
NArrow::TColumnFilter::TApplyContext().SetTrySlices(!HasAppData() || AppDataVerified().ColumnShardConfig.GetUseSlicesFilter())));
}
if (!Filter) {
Filter = std::make_shared<NArrow::TColumnFilter>(filter);
Expand Down Expand Up @@ -176,7 +179,8 @@ class TFetchedData {
DataAdded = true;
auto tableLocal = table;
if (Filter && UseFilter) {
AFL_VERIFY(Filter->Apply(tableLocal, NArrow::TColumnFilter::TApplyContext().SetTrySlices(true)));
AFL_VERIFY(Filter->Apply(tableLocal,
NArrow::TColumnFilter::TApplyContext().SetTrySlices(!HasAppData() || AppDataVerified().ColumnShardConfig.GetUseSlicesFilter())));
}
if (!Table) {
Table = std::make_shared<NArrow::TGeneralContainer>(tableLocal);
Expand Down Expand Up @@ -246,4 +250,4 @@ class TFetchedResult {
}
};

} // namespace NKikimr::NOlap
} // namespace NKikimr::NOlap::NReader::NCommon

0 comments on commit a39dc2a

Please sign in to comment.