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.
|
|
|
|
*/
|
|
|
|
class StorageHDFS : public ext::shared_ptr_helper<StorageHDFS>, public IStorage
|
|
|
|
{
|
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"; }
|
|
|
|
String getTableName() const override { return table_name; }
|
|
|
|
String getDatabaseName() const override { return database_name; }
|
2018-11-19 08:17:09 +00:00
|
|
|
|
|
|
|
BlockInputStreams read(const Names & column_names,
|
|
|
|
const SelectQueryInfo & query_info,
|
|
|
|
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;
|
|
|
|
|
2019-02-27 18:26:24 +00:00
|
|
|
BlockOutputStreamPtr write(const ASTPtr & query, const Context & context) override;
|
2018-11-19 08:17:09 +00:00
|
|
|
|
2019-08-27 23:47:30 +00:00
|
|
|
void rename(const String & new_path_to_db, const String & new_database_name, const String & new_table_name, TableStructureWriteLockHolder &) override;
|
2018-11-19 08:17:09 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
StorageHDFS(const String & uri_,
|
2019-07-09 15:40:21 +00:00
|
|
|
const String & database_name_,
|
2018-11-19 08:17:09 +00:00
|
|
|
const String & table_name_,
|
|
|
|
const String & format_name_,
|
|
|
|
const ColumnsDescription & columns_,
|
2019-08-24 21:20:20 +00:00
|
|
|
const ConstraintsDescription & constraints_,
|
2018-11-19 08:17:09 +00:00
|
|
|
Context & context_);
|
|
|
|
|
|
|
|
private:
|
|
|
|
String uri;
|
|
|
|
String format_name;
|
|
|
|
String table_name;
|
2019-07-09 15:40:21 +00:00
|
|
|
String database_name;
|
2019-01-17 14:10:30 +00:00
|
|
|
Context & context;
|
2018-11-19 08:17:09 +00:00
|
|
|
|
|
|
|
Logger * log = &Logger::get("StorageHDFS");
|
|
|
|
};
|
|
|
|
}
|
2018-12-05 13:24:45 +00:00
|
|
|
|
|
|
|
#endif
|