2018-11-19 08:17:09 +00:00
|
|
|
#pragma once
|
2018-12-05 13:24:45 +00:00
|
|
|
|
2019-08-04 00:19:03 +00:00
|
|
|
#include <Common/config.h>
|
|
|
|
|
2018-12-05 13:24:45 +00:00
|
|
|
#if USE_HDFS
|
2018-11-19 08:17:09 +00:00
|
|
|
#include <IO/ReadBuffer.h>
|
|
|
|
#include <IO/BufferWithOwnMemory.h>
|
2018-12-27 15:23:37 +00:00
|
|
|
#include <string>
|
2019-01-17 11:26:29 +00:00
|
|
|
#include <memory>
|
2018-11-19 08:17:09 +00:00
|
|
|
|
2020-10-30 19:40:16 +00:00
|
|
|
#include <hdfs/hdfs.h>
|
|
|
|
|
|
|
|
#include <common/types.h>
|
|
|
|
|
|
|
|
#include <Interpreters/Context.h>
|
|
|
|
|
|
|
|
|
2018-11-19 08:17:09 +00:00
|
|
|
namespace DB
|
|
|
|
{
|
2019-01-18 10:57:00 +00:00
|
|
|
/** Accepts HDFS path to file and opens it.
|
2019-01-17 11:26:29 +00:00
|
|
|
* Closes file by himself (thus "owns" a file descriptor).
|
|
|
|
*/
|
|
|
|
class ReadBufferFromHDFS : public BufferWithOwnMemory<ReadBuffer>
|
|
|
|
{
|
|
|
|
struct ReadBufferFromHDFSImpl;
|
|
|
|
std::unique_ptr<ReadBufferFromHDFSImpl> impl;
|
|
|
|
public:
|
2020-11-27 22:17:05 +00:00
|
|
|
ReadBufferFromHDFS(const std::string & hdfs_name_, const Poco::Util::AbstractConfiguration &, size_t buf_size_ = DBMS_DEFAULT_BUFFER_SIZE);
|
2020-03-09 01:03:43 +00:00
|
|
|
~ReadBufferFromHDFS() override;
|
2018-11-19 08:17:09 +00:00
|
|
|
|
2019-01-17 11:26:29 +00:00
|
|
|
bool nextImpl() override;
|
|
|
|
};
|
2018-11-19 08:17:09 +00:00
|
|
|
}
|
2018-12-05 13:24:45 +00:00
|
|
|
#endif
|