From 028d5c8c02ae3b4b232270f000f8928959375fed Mon Sep 17 00:00:00 2001 From: liuneng <1398775315@qq.com> Date: Tue, 16 Jan 2024 11:07:02 +0800 Subject: [PATCH] support mergetree on s3 plain --- .../MetadataStorageFromPlainObjectStorage.cpp | 11 ++++++----- src/Processors/QueryPlan/ReadFromMergeTree.h | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/Disks/ObjectStorages/MetadataStorageFromPlainObjectStorage.cpp b/src/Disks/ObjectStorages/MetadataStorageFromPlainObjectStorage.cpp index f20cd67a39fb..b71a5fc40e0c 100644 --- a/src/Disks/ObjectStorages/MetadataStorageFromPlainObjectStorage.cpp +++ b/src/Disks/ObjectStorages/MetadataStorageFromPlainObjectStorage.cpp @@ -81,13 +81,14 @@ std::vector MetadataStorageFromPlainObjectStorage::listDirectory(co } std::unordered_set duplicates_filter; + auto prefix = object_storage->generateObjectKeyForPath("example"); for (auto & row : result) { - chassert(row.starts_with(abs_key)); - row.erase(0, abs_key.size()); - auto slash_pos = row.find_first_of('/'); - if (slash_pos != std::string::npos) - row.erase(slash_pos, row.size() - slash_pos); + chassert(row.starts_with(prefix.getPrefix())); + row.erase(0, prefix.getPrefix().size()); +// auto slash_pos = row.find_first_of('/'); +// if (slash_pos != std::string::npos) +// row.erase(slash_pos, row.size() - slash_pos); duplicates_filter.insert(row); } diff --git a/src/Processors/QueryPlan/ReadFromMergeTree.h b/src/Processors/QueryPlan/ReadFromMergeTree.h index 58258f8db4d0..6b2631c0a80b 100644 --- a/src/Processors/QueryPlan/ReadFromMergeTree.h +++ b/src/Processors/QueryPlan/ReadFromMergeTree.h @@ -194,6 +194,7 @@ class ReadFromMergeTree final : public SourceStepWithFilter bool hasAnalyzedResult() const { return analyzed_result_ptr != nullptr; } void setAnalyzedResult(AnalysisResultPtr analyzed_result_ptr_) { analyzed_result_ptr = std::move(analyzed_result_ptr_); } + ReadFromMergeTree::AnalysisResult getAnalysisResult() const; const MergeTreeData::DataPartsVector & getParts() const { return prepared_parts; } const std::vector & getAlterConvertionsForParts() const { return alter_conversions_for_parts; } @@ -289,7 +290,6 @@ class ReadFromMergeTree final : public SourceStepWithFilter Pipe spreadMarkRangesAmongStreamsFinal( RangesInDataParts && parts, size_t num_streams, const Names & origin_column_names, const Names & column_names, ActionsDAGPtr & out_projection); - ReadFromMergeTree::AnalysisResult getAnalysisResult() const; AnalysisResultPtr analyzed_result_ptr; bool is_parallel_reading_from_replicas;