You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by ap...@apache.org on 2018/07/31 14:19:00 UTC
[arrow] branch master updated: ARROW-2943: [C++] Implement
BufferedOutputStream::Flush
This is an automated email from the ASF dual-hosted git repository.
apitrou pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow.git
The following commit(s) were added to refs/heads/master by this push:
new c7175c4 ARROW-2943: [C++] Implement BufferedOutputStream::Flush
c7175c4 is described below
commit c7175c4df0063e885215721fe30660e0033a8a18
Author: Antoine Pitrou <an...@python.org>
AuthorDate: Tue Jul 31 16:18:02 2018 +0200
ARROW-2943: [C++] Implement BufferedOutputStream::Flush
Author: Antoine Pitrou <an...@python.org>
Closes #2346 from pitrou/ARROW-2943 and squashes the following commits:
200bac1 <Antoine Pitrou> ARROW-2943: Implement BufferedOutputStream::Flush
---
cpp/src/arrow/io/buffered.cc | 2 ++
cpp/src/arrow/io/buffered.h | 2 ++
cpp/src/arrow/io/io-buffered-test.cc | 14 ++++++++++++++
3 files changed, 18 insertions(+)
diff --git a/cpp/src/arrow/io/buffered.cc b/cpp/src/arrow/io/buffered.cc
index 7ff8ad6..459e693 100644
--- a/cpp/src/arrow/io/buffered.cc
+++ b/cpp/src/arrow/io/buffered.cc
@@ -131,6 +131,8 @@ Status BufferedOutputStream::Write(const void* data, int64_t nbytes) {
return impl_->Write(data, nbytes);
}
+Status BufferedOutputStream::Flush() { return impl_->Flush(); }
+
std::shared_ptr<OutputStream> BufferedOutputStream::raw() const { return impl_->raw(); }
} // namespace io
diff --git a/cpp/src/arrow/io/buffered.h b/cpp/src/arrow/io/buffered.h
index deb344c..4d4dd25 100644
--- a/cpp/src/arrow/io/buffered.h
+++ b/cpp/src/arrow/io/buffered.h
@@ -49,6 +49,8 @@ class ARROW_EXPORT BufferedOutputStream : public OutputStream {
// Write bytes to the stream. Thread-safe
Status Write(const void* data, int64_t nbytes) override;
+ Status Flush() override;
+
/// \brief Return the underlying raw output stream.
std::shared_ptr<OutputStream> raw() const;
diff --git a/cpp/src/arrow/io/io-buffered-test.cc b/cpp/src/arrow/io/io-buffered-test.cc
index 0fa5ca1..efa2301 100644
--- a/cpp/src/arrow/io/io-buffered-test.cc
+++ b/cpp/src/arrow/io/io-buffered-test.cc
@@ -188,6 +188,20 @@ TEST_F(TestBufferedOutputStream, LargeWrites) {
AssertFileContents(path_, data);
}
+TEST_F(TestBufferedOutputStream, Flush) {
+ OpenBuffered();
+
+ const std::string datastr = "1234568790";
+ const char* data = datastr.data();
+
+ ASSERT_OK(stream_->Write(data, datastr.size()));
+ ASSERT_OK(stream_->Flush());
+
+ AssertFileContents(path_, datastr);
+
+ ASSERT_OK(stream_->Close());
+}
+
TEST_F(TestBufferedOutputStream, Tell) {
OpenBuffered();