You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "felipecrv (via GitHub)" <gi...@apache.org> on 2023/04/28 00:34:52 UTC

[GitHub] [arrow] felipecrv commented on a diff in pull request #35129: GH-35059: [C++] Fix "hash_count" for run-end encoded inputs

felipecrv commented on code in PR #35129:
URL: https://github.com/apache/arrow/pull/35129#discussion_r1179829093


##########
cpp/src/arrow/testing/gtest_util.cc:
##########
@@ -427,6 +428,24 @@ std::shared_ptr<Table> TableFromJSON(const std::shared_ptr<Schema>& schema,
   return *Table::FromRecordBatches(schema, std::move(batches));
 }
 
+Result<std::shared_ptr<Table>> RunEndEncodeTableColumns(
+    const Table& table, const std::vector<int>& column_indices) {
+  const int num_columns = table.num_columns();
+  std::vector<std::shared_ptr<ChunkedArray>> encoded_columns;
+  encoded_columns.reserve(num_columns);
+  for (int i = 0; i < num_columns; i++) {
+    if (std::find(column_indices.begin(), column_indices.end(), i) !=
+        column_indices.end()) {
+      EXPECT_OK_AND_ASSIGN(auto run_end_encoded, compute::RunEndEncode(table.column(i)));
+      EXPECT_EQ(run_end_encoded.kind(), Datum::CHUNKED_ARRAY);

Review Comment:
   Isn't this better for things used in tests? These are not really expected to fail, so these checks are more assert-like than regular error checking. I found this to be a pattern in this file.



-- 
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