2018-11-19 08:17:09 +00:00
|
|
|
#pragma once
|
2018-12-05 13:24:45 +00:00
|
|
|
#include <Common/config.h>
|
|
|
|
#if USE_HDFS
|
2018-11-19 08:17:09 +00:00
|
|
|
|
|
|
|
#include <Storages/IStorage.h>
|
|
|
|
#include <Poco/URI.h>
|
|
|
|
#include <common/logger_useful.h>
|
|
|
|
#include <ext/shared_ptr_helper.h>
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* This class represents table engine for external hdfs files.
|
|
|
|
* Read method is supported for now.
|
|
|
|
*/
|
2020-03-19 23:48:53 +00:00
|
|
|
class StorageHDFS final : public ext::shared_ptr_helper<StorageHDFS>, public IStorage
|
2018-11-19 08:17:09 +00:00
|
|
|
{
|
2019-08-26 19:07:29 +00:00
|
|
|
friend struct ext::shared_ptr_helper<StorageHDFS>;
|
2018-11-19 08:17:09 +00:00
|
|
|
public:
|
2019-07-09 15:40:21 +00:00
|
|
|
String getName() const override { return "HDFS"; }
|
2018-11-19 08:17:09 +00:00
|
|
|
|
2020-08-03 13:54:14 +00:00
|
|
|
Pipe read(
|
2020-06-15 19:08:58 +00:00
|
|
|
const Names & column_names,
|
|
|
|
const StorageMetadataPtr & /*metadata_snapshot*/,
|
2020-09-20 17:52:17 +00:00
|
|
|
SelectQueryInfo & query_info,
|
2018-11-19 08:17:09 +00:00
|
|
|
const Context & context,
|
|
|
|
QueryProcessingStage::Enum processed_stage,
|
2019-02-18 23:38:44 +00:00
|
|
|
size_t max_block_size,
|
2018-11-19 08:17:09 +00:00
|
|
|
unsigned num_streams) override;
|
|
|
|
|
2020-06-15 19:08:58 +00:00
|
|
|
BlockOutputStreamPtr write(const ASTPtr & query, const StorageMetadataPtr & /*metadata_snapshot*/, const Context & context) override;
|
2018-11-19 08:17:09 +00:00
|
|
|
|
2020-04-28 10:38:57 +00:00
|
|
|
NamesAndTypesList getVirtuals() const override;
|
2020-04-27 13:55:30 +00:00
|
|
|
|
2018-11-19 08:17:09 +00:00
|
|
|
protected:
|
|
|
|
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_,
|
2019-11-19 12:46:07 +00:00
|
|
|
Context & context_,
|
|
|
|
const String & compression_method_);
|
2018-11-19 08:17:09 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
String uri;
|
|
|
|
String format_name;
|
2019-01-17 14:10:30 +00:00
|
|
|
Context & context;
|
2019-11-19 12:46:07 +00:00
|
|
|
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
|
|
|
};
|
|
|
|
}
|
2018-12-05 13:24:45 +00:00
|
|
|
|
|
|
|
#endif
|