-
Notifications
You must be signed in to change notification settings - Fork 6.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #59322 from ClickHouse/backport/23.12/58877
Backport #58877 to 23.12: Multiple read file log storage in mv
- Loading branch information
Showing
9 changed files
with
285 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#include <Processors/QueryPlan/ReadFromStreamLikeEngine.h> | ||
|
||
#include <Interpreters/InterpreterSelectQuery.h> | ||
#include <QueryPipeline/QueryPipelineBuilder.h> | ||
|
||
namespace DB | ||
{ | ||
|
||
namespace ErrorCodes | ||
{ | ||
extern const int QUERY_NOT_ALLOWED; | ||
} | ||
|
||
ReadFromStreamLikeEngine::ReadFromStreamLikeEngine( | ||
const Names & column_names_, | ||
const StorageSnapshotPtr & storage_snapshot_, | ||
std::shared_ptr<const StorageLimitsList> storage_limits_, | ||
ContextPtr context_) | ||
: ISourceStep{DataStream{.header = storage_snapshot_->getSampleBlockForColumns(column_names_)}} | ||
, WithContext{context_} | ||
, storage_limits{std::move(storage_limits_)} | ||
{ | ||
} | ||
|
||
void ReadFromStreamLikeEngine::initializePipeline(QueryPipelineBuilder & pipeline, const BuildQueryPipelineSettings &) | ||
{ | ||
if (!getContext()->getSettingsRef().stream_like_engine_allow_direct_select) | ||
throw Exception( | ||
ErrorCodes::QUERY_NOT_ALLOWED, "Direct select is not allowed. To enable use setting `stream_like_engine_allow_direct_select`"); | ||
|
||
auto pipe = makePipe(); | ||
|
||
/// Add storage limits. | ||
for (const auto & processor : pipe.getProcessors()) | ||
processor->setStorageLimits(storage_limits); | ||
|
||
/// Add to processors to get processor info through explain pipeline statement. | ||
for (const auto & processor : pipe.getProcessors()) | ||
processors.emplace_back(processor); | ||
|
||
pipeline.init(std::move(pipe)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#pragma once | ||
|
||
#include <Processors/QueryPlan/ISourceStep.h> | ||
#include <Storages/IStorage.h> | ||
#include <Storages/StorageSnapshot.h> | ||
|
||
namespace DB | ||
{ | ||
class ReadFromStreamLikeEngine : public ISourceStep, protected WithContext | ||
{ | ||
public: | ||
ReadFromStreamLikeEngine( | ||
const Names & column_names_, | ||
const StorageSnapshotPtr & storage_snapshot_, | ||
std::shared_ptr<const StorageLimitsList> storage_limits_, | ||
ContextPtr context_); | ||
|
||
void initializePipeline(QueryPipelineBuilder & pipeline, const BuildQueryPipelineSettings & /*settings*/) final; | ||
|
||
protected: | ||
virtual Pipe makePipe() = 0; | ||
|
||
std::shared_ptr<const StorageLimitsList> storage_limits; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.