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
|
|
|
|
|
|
|
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:
|
|
|
|
ReadBufferFromHDFS(const std::string & hdfs_name_, size_t buf_size = DBMS_DEFAULT_BUFFER_SIZE);
|
|
|
|
ReadBufferFromHDFS(ReadBufferFromHDFS &&) = default;
|
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
|