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 <antoine@python.org>

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
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(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 @@
 
   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));
-
-  auto expected_buffer = std::make_shared<Buffer>(data_buffer + 4, 7);
-
+  expected_buffer = std::make_shared<Buffer>(data_buffer + 4, 7);
   ASSERT_TRUE(expected_buffer->Equals(*pq_buffer.get()));
+
+  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