blob: c1d081b84f6d6bc85db3a07b029d031f30c0bbab (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
#include <yql/essentials/providers/common/codec/yql_codec_buf.h>
#include <arrow/io/interfaces.h>
#include <arrow/result.h>
namespace NYql {
namespace NCommon {
class TOutputBufArrowOutputStream : public arrow::io::OutputStream {
public:
explicit TOutputBufArrowOutputStream(TOutputBuf& buffer)
: Buffer_(buffer)
{
set_mode(arrow::io::FileMode::type::WRITE);
}
arrow::Status Write(const void* data, int64_t nbytes) override;
arrow::Status Flush() override;
arrow::Status Close() override {
return arrow::Status::OK();
}
arrow::Result<int64_t> Tell() const override {
return BytesWritten_;
}
bool closed() const override {
return false;
}
private:
TOutputBuf& Buffer_;
int64_t BytesWritten_ = 0;
};
} // NCommon
} // NYql
|