mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-19 16:20:50 +00:00
A simple interface to find temporary files by their logical names when building pipeline from query plan
This commit is contained in:
parent
2df5edc1c1
commit
7d042be8eb
@ -12,12 +12,15 @@ namespace DB
|
||||
struct Settings;
|
||||
class QueryStatus;
|
||||
using QueryStatusPtr = std::shared_ptr<QueryStatus>;
|
||||
struct ITemporaryFileLookup;
|
||||
using TemporaryFileLookupPtr = std::shared_ptr<ITemporaryFileLookup>;
|
||||
|
||||
struct BuildQueryPipelineSettings
|
||||
{
|
||||
ExpressionActionsSettings actions_settings;
|
||||
QueryStatusPtr process_list_element;
|
||||
ProgressCallback progress_callback = nullptr;
|
||||
TemporaryFileLookupPtr temporary_file_lookup;
|
||||
|
||||
const ExpressionActionsSettings & getActionsSettings() const { return actions_settings; }
|
||||
static BuildQueryPipelineSettings fromContext(ContextPtr from);
|
||||
|
31
src/Processors/QueryPlan/TemporaryFiles.h
Normal file
31
src/Processors/QueryPlan/TemporaryFiles.h
Normal file
@ -0,0 +1,31 @@
|
||||
#pragma once
|
||||
|
||||
#include <base/types.h>
|
||||
#include <boost/noncopyable.hpp>
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
|
||||
namespace DB
|
||||
{
|
||||
|
||||
class WriteBuffer;
|
||||
class ReadBuffer;
|
||||
|
||||
/// Interface for accessing temporary files by some logical name (or id).
|
||||
/// While building query pipeline processors can lookup temporary files by some id and use them for writing and/or reading temporary data
|
||||
/// without knowing what exactly is behind the name: local file, memory buffer, object in cloud storage, etc.
|
||||
struct ITemporaryFileLookup : boost::noncopyable
|
||||
{
|
||||
virtual ~ITemporaryFileLookup() = default;
|
||||
|
||||
/// Give the caller a temporary write buffer, but don't give away the ownership.
|
||||
virtual WriteBuffer & getTemporaryFileForWriting(const String & file_id) = 0;
|
||||
|
||||
/// Give the caller a temporary read buffer, it exclusively belongs to the caller.
|
||||
/// Other callers can get their own read buffer for the same temporary file.
|
||||
virtual std::unique_ptr<ReadBuffer> getTemporaryFileForReading(const String & file_id) = 0;
|
||||
};
|
||||
|
||||
using TemporaryFileLookupPtr = std::shared_ptr<ITemporaryFileLookup>;
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user