This is an automated email from the ASF dual-hosted git repository.
uwe pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/parquet-cpp.git
The following commit(s) were added to refs/heads/master by this push:
new c9bc237 PARQUET-1307: Fix memory-test for newer Arrow
c9bc237 is described below
commit c9bc237f455ffe53463d6b5251ca1d138d0abd6f
Author: Antoine Pitrou <[email protected]>
AuthorDate: Sat May 26 16:34:36 2018 +0200
PARQUET-1307: Fix memory-test for newer Arrow
In recent Arrow builds, ReadAt() doesn't specify whether it updates the
file position or not.
(ideally, it does not, but on certain platforms the file position may be
updated anyway -- e.g. Windows)
Author: Antoine Pitrou <[email protected]>
Closes #466 from pitrou/PARQUET-1307-memory-test-fix and squashes the
following commits:
ffd6dc0 [Antoine Pitrou] PARQUET-1307: Fix memory-test for newer Arrow
---
src/parquet/util/memory-test.cc | 30 ++++++++++++++++++++++++++----
1 file changed, 26 insertions(+), 4 deletions(-)
diff --git a/src/parquet/util/memory-test.cc b/src/parquet/util/memory-test.cc
index 17ade21..4b620ab 100644
--- a/src/parquet/util/memory-test.cc
+++ b/src/parquet/util/memory-test.cc
@@ -312,7 +312,7 @@ TEST(TestBufferedInputStream, Basics) {
}
}
-TEST(TestArrowInputFile, Basics) {
+TEST(TestArrowInputFile, ReadAt) {
std::string data = "this is the data";
auto data_buffer = reinterpret_cast<const uint8_t*>(data.c_str());
@@ -325,15 +325,37 @@ TEST(TestArrowInputFile, Basics) {
ASSERT_NO_THROW(source->ReadAt(0, 4, buffer));
ASSERT_EQ(0, std::memcmp(buffer, "this", 4));
- ASSERT_EQ(4, source->Tell());
- std::shared_ptr<Buffer> pq_buffer;
+ // Note: it's undefined (and possibly platform-dependent) whether
ArrowInputFile
+ // updates the file position after ReadAt().
+}
+
+TEST(TestArrowInputFile, Read) {
+ std::string data = "this is the data";
+ auto data_buffer = reinterpret_cast<const uint8_t*>(data.c_str());
+
+ auto file = std::make_shared<::arrow::io::BufferReader>(data_buffer,
data.size());
+ auto source = std::make_shared<ArrowInputFile>(file);
+
+ ASSERT_EQ(0, source->Tell());
+
+ std::shared_ptr<Buffer> pq_buffer, expected_buffer;
+
+ ASSERT_NO_THROW(pq_buffer = source->Read(4));
+ expected_buffer = std::make_shared<Buffer>(data_buffer, 4);
+ ASSERT_TRUE(expected_buffer->Equals(*pq_buffer.get()));
ASSERT_NO_THROW(pq_buffer = source->Read(7));
+ expected_buffer = std::make_shared<Buffer>(data_buffer + 4, 7);
+ ASSERT_TRUE(expected_buffer->Equals(*pq_buffer.get()));
- auto expected_buffer = std::make_shared<Buffer>(data_buffer + 4, 7);
+ ASSERT_EQ(11, source->Tell());
+ ASSERT_NO_THROW(pq_buffer = source->Read(8));
+ expected_buffer = std::make_shared<Buffer>(data_buffer + 11, 5);
ASSERT_TRUE(expected_buffer->Equals(*pq_buffer.get()));
+
+ ASSERT_EQ(16, source->Tell());
}
} // namespace parquet
--
To stop receiving notification emails like this one, please contact
[email protected].