ClickHouse/src/Storages/HDFS/StorageHDFS.h

64 lines
1.7 KiB
C++
Raw Normal View History

2018-11-19 08:17:09 +00:00
#pragma once
2021-06-11 11:26:33 +00:00
#if !defined(ARCADIA_BUILD)
#include <Common/config.h>
2021-06-11 11:26:33 +00:00
#endif
#if USE_HDFS
2018-11-19 08:17:09 +00:00
#include <Storages/IStorage.h>
#include <Poco/URI.h>
2021-10-02 07:13:14 +00:00
#include <base/logger_useful.h>
#include <base/shared_ptr_helper.h>
2018-11-19 08:17:09 +00:00
namespace DB
{
/**
* This class represents table engine for external hdfs files.
* Read method is supported for now.
*/
2021-06-15 19:55:21 +00:00
class StorageHDFS final : public shared_ptr_helper<StorageHDFS>, public IStorage, WithContext
2018-11-19 08:17:09 +00:00
{
2021-06-15 19:55:21 +00:00
friend struct shared_ptr_helper<StorageHDFS>;
2018-11-19 08:17:09 +00:00
public:
String getName() const override { return "HDFS"; }
2018-11-19 08:17:09 +00:00
2020-08-03 13:54:14 +00:00
Pipe read(
const Names & column_names,
const StorageMetadataPtr & /*metadata_snapshot*/,
SelectQueryInfo & query_info,
ContextPtr context,
2018-11-19 08:17:09 +00:00
QueryProcessingStage::Enum processed_stage,
size_t max_block_size,
2018-11-19 08:17:09 +00:00
unsigned num_streams) override;
2021-07-23 19:33:59 +00:00
SinkToStoragePtr write(const ASTPtr & query, const StorageMetadataPtr & /*metadata_snapshot*/, ContextPtr context) override;
2018-11-19 08:17:09 +00:00
2021-06-21 15:44:36 +00:00
void truncate(const ASTPtr & query, const StorageMetadataPtr & metadata_snapshot, ContextPtr context_, TableExclusiveLockHolder &) override;
2021-06-21 13:50:09 +00:00
NamesAndTypesList getVirtuals() const override;
2020-04-27 13:55:30 +00:00
2021-10-25 16:23:44 +00:00
bool supportsPartitionBy() const override { return true; }
2018-11-19 08:17:09 +00:00
protected:
2021-04-23 12:18:23 +00:00
StorageHDFS(
const String & uri_,
2019-12-04 16:06:55 +00:00
const StorageID & table_id_,
2018-11-19 08:17:09 +00:00
const String & format_name_,
const ColumnsDescription & columns_,
2019-08-24 21:20:20 +00:00
const ConstraintsDescription & constraints_,
2021-04-23 12:18:23 +00:00
const String & comment,
ContextPtr context_,
const String & compression_method_);
2018-11-19 08:17:09 +00:00
private:
2021-04-20 07:53:55 +00:00
const String uri;
2018-11-19 08:17:09 +00:00
String format_name;
String compression_method;
2018-11-19 08:17:09 +00:00
2020-05-30 21:57:37 +00:00
Poco::Logger * log = &Poco::Logger::get("StorageHDFS");
2018-11-19 08:17:09 +00:00
};
}
#endif