[ 
https://issues.apache.org/jira/browse/PARQUET-1307?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16491678#comment-16491678
 ] 

ASF GitHub Bot commented on PARQUET-1307:
-----------------------------------------

xhochy closed pull request #466: PARQUET-1307: Fix memory-test for newer Arrow
URL: https://github.com/apache/parquet-cpp/pull/466
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/src/parquet/util/memory-test.cc b/src/parquet/util/memory-test.cc
index 17ade21e..4b620ab8 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


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


> [C++] memory-test fails with latest Arrow
> -----------------------------------------
>
>                 Key: PARQUET-1307
>                 URL: https://issues.apache.org/jira/browse/PARQUET-1307
>             Project: Parquet
>          Issue Type: Bug
>          Components: parquet-cpp
>            Reporter: Antoine Pitrou
>            Assignee: Antoine Pitrou
>            Priority: Major
>             Fix For: cpp-1.5.0
>
>
> {code}
> $ ./build-debug/debug/memory-test 
> Running main() from gtest_main.cc
> [==========] Running 7 tests from 3 test cases.
> [----------] Global test environment set-up.
> [----------] 5 tests from ChunkedAllocatorTest
> [ RUN      ] ChunkedAllocatorTest.Basic
> [       OK ] ChunkedAllocatorTest.Basic (0 ms)
> [ RUN      ] ChunkedAllocatorTest.Keep
> [       OK ] ChunkedAllocatorTest.Keep (0 ms)
> [ RUN      ] ChunkedAllocatorTest.ReturnPartial
> [       OK ] ChunkedAllocatorTest.ReturnPartial (0 ms)
> [ RUN      ] ChunkedAllocatorTest.MemoryOverhead
> [       OK ] ChunkedAllocatorTest.MemoryOverhead (1 ms)
> [ RUN      ] ChunkedAllocatorTest.FragmentationOverhead
> [       OK ] ChunkedAllocatorTest.FragmentationOverhead (1 ms)
> [----------] 5 tests from ChunkedAllocatorTest (2 ms total)
> [----------] 1 test from TestBufferedInputStream
> [ RUN      ] TestBufferedInputStream.Basics
> [       OK ] TestBufferedInputStream.Basics (0 ms)
> [----------] 1 test from TestBufferedInputStream (0 ms total)
> [----------] 1 test from TestArrowInputFile
> [ RUN      ] TestArrowInputFile.Basics
> /home/antoine/parquet-cpp/src/parquet/util/memory-test.cc:328: Failure
>       Expected: 4
> To be equal to: source->Tell()
>       Which is: 0
> [  FAILED  ] TestArrowInputFile.Basics (0 ms)
> [----------] 1 test from TestArrowInputFile (0 ms total)
> [----------] Global test environment tear-down
> [==========] 7 tests from 3 test cases ran. (2 ms total)
> [  PASSED  ] 6 tests.
> [  FAILED  ] 1 test, listed below:
> [  FAILED  ] TestArrowInputFile.Basics
>  1 FAILED TEST
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to