You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "wgtmac (via GitHub)" <gi...@apache.org> on 2023/06/25 02:18:33 UTC

[GitHub] [arrow] wgtmac commented on a diff in pull request #36192: PARQUET-2316: [C++] Allow partial PreBuffer in the parquet FileReader

wgtmac commented on code in PR #36192:
URL: https://github.com/apache/arrow/pull/36192#discussion_r1241001888


##########
cpp/src/parquet/arrow/arrow_reader_writer_test.cc:
##########
@@ -2382,6 +2382,34 @@ TEST(TestArrowReadWrite, WaitCoalescedReads) {
   ASSERT_EQ(actual_batch->num_rows(), num_rows);
 }
 
+// Use coalesced reads and non-coaleasced reads for different column chunks.
+TEST(TestArrowReadWrite, CoalescedReadsAndNonCoalescedReads) {
+  const int num_columns = 5;
+  const int num_rows = 128;

Review Comment:
   ```suggestion
     constexpr int num_columns = 5;
     constexpr int num_rows = 128;
   ```



##########
cpp/src/parquet/arrow/arrow_reader_writer_test.cc:
##########
@@ -2382,6 +2382,34 @@ TEST(TestArrowReadWrite, WaitCoalescedReads) {
   ASSERT_EQ(actual_batch->num_rows(), num_rows);
 }
 
+// Use coalesced reads and non-coaleasced reads for different column chunks.
+TEST(TestArrowReadWrite, CoalescedReadsAndNonCoalescedReads) {
+  const int num_columns = 5;
+  const int num_rows = 128;
+
+  std::shared_ptr<Table> expected;
+  ASSERT_NO_FATAL_FAILURE(MakeDoubleTable(num_columns, num_rows, 1, &expected));

Review Comment:
   ```suggestion
     ASSERT_NO_FATAL_FAILURE(MakeDoubleTable(num_columns, num_rows, /*nchunks=*/1, &expected));
   ```



##########
cpp/src/parquet/arrow/arrow_reader_writer_test.cc:
##########
@@ -2382,6 +2382,34 @@ TEST(TestArrowReadWrite, WaitCoalescedReads) {
   ASSERT_EQ(actual_batch->num_rows(), num_rows);
 }
 
+// Use coalesced reads and non-coaleasced reads for different column chunks.
+TEST(TestArrowReadWrite, CoalescedReadsAndNonCoalescedReads) {
+  const int num_columns = 5;
+  const int num_rows = 128;
+
+  std::shared_ptr<Table> expected;
+  ASSERT_NO_FATAL_FAILURE(MakeDoubleTable(num_columns, num_rows, 1, &expected));
+
+  std::shared_ptr<Buffer> buffer;
+  ASSERT_NO_FATAL_FAILURE(WriteTableToBuffer(expected, num_rows / 2,
+                                             default_arrow_writer_properties(), &buffer));
+
+  std::unique_ptr<FileReader> reader;
+  ASSERT_OK_NO_THROW(OpenFile(std::make_shared<BufferReader>(buffer),
+                              ::arrow::default_memory_pool(), &reader));
+
+  ASSERT_EQ(2, reader->num_row_groups());
+
+  // Pre-buffer 3 columns in the 2nd row group.
+  reader->parquet_reader()->PreBuffer({1}, {0, 1, 4}, ::arrow::io::IOContext(),
+                                      ::arrow::io::CacheOptions::Defaults());
+  ASSERT_OK(reader->parquet_reader()->WhenBuffered({1}, {0, 1, 4}).status());

Review Comment:
   ```suggestion
     const std::vector<int> row_groups = {1};
     const std::vector<int> column_indices = {0, 1, 4};
     reader->parquet_reader()->PreBuffer(row_groups, column_indices, ::arrow::io::IOContext(),
                                         ::arrow::io::CacheOptions::Defaults());
     ASSERT_OK(reader->parquet_reader()->WhenBuffered(row_groups, column_indices).status());
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org