Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions ydb/core/kqp/ut/olap/sys_view_ut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -633,6 +633,17 @@ Y_UNIT_TEST_SUITE(KqpOlapSysView) {

auto tableClient = kikimr.GetTableClient();

{
auto selectQuery = TString(R"(
SELECT *
FROM `/Root/olapStore/.sys/store_primary_index_stats`
ORDER BY PathId
LIMIT 10
)");

auto rows = ExecuteScanQuery(tableClient, selectQuery);
}

{
auto selectQuery = TString(R"(
SELECT *
Expand Down
7 changes: 4 additions & 3 deletions ydb/core/tx/columnshard/engines/metadata_accessor.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,17 @@ class ITableMetadataAccessor {

public:
ITableMetadataAccessor(const TString& tablePath);

virtual bool OrderByLimitAllowed() const {
return true;
}
virtual bool NeedDuplicateFiltering() const {
return true;
}
virtual bool NeedStalenessChecker() const {
return true;
}
virtual ~ITableMetadataAccessor() = default;
virtual TString GetOverridenScanType(const TString& defScanType) const {
return defScanType;
}
virtual std::optional<NColumnShard::TUnifiedOptionalPathId> GetPathId() const {
return std::nullopt;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class ISourcesConstructor {
virtual TString DoDebugString() const = 0;
bool InitCursorFlag = false;
virtual void DoFillReadStats(TReadStats& /*stats*/) const {

}

public:
Expand Down Expand Up @@ -192,6 +192,10 @@ class TReadMetadata: public TReadMetadataBase {
TReadMetadata(const TReadMetadata&) = delete;
TReadMetadata& operator=(const TReadMetadata&) = delete;

bool OrderByLimitAllowed() const {
return TableMetadataAccessor->OrderByLimitAllowed() && !GetFakeSort();
}

virtual std::vector<TNameTypeInfo> GetKeyYqlSchema() const override {
return GetResultSchema()->GetIndexInfo().GetPrimaryKeyColumns();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ TScanHead::TScanHead(std::unique_ptr<NCommon::ISourcesConstructor>&& sourcesCons
SyncPoints.emplace_back(std::make_shared<TSyncPointResultsAggregationControl>(
SourcesCollection, Context->GetSourcesAggregationScript(), Context->GetRestoreResultScript(), SyncPoints.size(), context));
} else if (readMetadataContext->IsSorted()) {
if (readMetadataContext->HasLimit() && !readMetadataContext->GetFakeSort()) {
if (readMetadataContext->HasLimit() && readMetadataContext->OrderByLimitAllowed()) {
auto collection = std::make_shared<TScanWithLimitCollection>(Context, std::move(sourcesConstructor));
SourcesCollection = collection;
SyncPoints.emplace_back(std::make_shared<TSyncPointLimitControl>(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ class TAccessor: public ITableMetadataAccessor {
return PathId;
}

virtual TString GetOverridenScanType(const TString& /*defScanType*/) const override {
return "SIMPLE";
virtual bool OrderByLimitAllowed() const override {
return false;
}

virtual bool NeedDuplicateFiltering() const override {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ void TTxScan::Complete(const TActorContext& ctx) {
return request.GetCSScanPolicy() ? request.GetCSScanPolicy() : defaultReader;
}();
auto constructor =
NReader::IScannerConstructor::TFactory::MakeHolder(read.TableMetadataAccessor->GetOverridenScanType(scanType), context);
NReader::IScannerConstructor::TFactory::MakeHolder(scanType, context);
if (!constructor) {
return std::unique_ptr<IScannerConstructor>();
}
Expand Down Expand Up @@ -157,7 +157,7 @@ void TTxScan::Complete(const TActorContext& ctx) {
return SendError("cannot build metadata", newRange.GetErrorMessage(), ctx);
}
}

if (AppDataVerified().ColumnShardConfig.GetEnableDiagnostics()) {
auto graphOptional = read.GetProgram().GetGraphOptional();
TString dotGraph = graphOptional ? graphOptional->DebugDOT() : "";
Expand Down
Loading