iajoiner commented on a change in pull request #9702:
URL: https://github.com/apache/arrow/pull/9702#discussion_r787404883



##########
File path: cpp/src/arrow/adapters/orc/adapter_test.cc
##########
@@ -226,19 +224,54 @@ std::shared_ptr<Table> GenerateRandomTable(const 
std::shared_ptr<Schema>& schema
   return Table::Make(schema, cv);
 }
 
+arrow::adapters::orc::WriteOptions GenerateRandomWriteOptions(int64_t 
num_cols) {
+  auto arrow_write_options = arrow::adapters::orc::WriteOptions();
+  arrow_write_options.batch_size = arrow::random_single_int<int64_t, 
int64_t>(4ull, 8ull);
+  arrow_write_options.file_version = arrow::adapters::orc::FileVersion(
+      0, arrow::random_single_int<int32_t, int32_t>(11, 12));
+  arrow_write_options.stripe_size =
+      arrow::random_single_int<int64_t, int64_t>(4ull, 128ull);
+  arrow_write_options.compression_block_size =
+      arrow::random_single_int<int64_t, int64_t>(4ull, 128ull);
+  arrow_write_options.row_index_stride =
+      arrow::random_single_int<int64_t, int64_t>(0, 128ull);
+  arrow_write_options.compression =
+      arrow::random_single_int<int8_t, arrow::Compression::type>(0, 2);
+  arrow_write_options.compression_strategy =
+      arrow::random_single_int<int8_t, 
arrow::adapters::orc::CompressionStrategy>(0, 1);
+  arrow_write_options.padding_tolerance = arrow::random_single_real<double, 
double>(0, 1);
+  arrow_write_options.dictionary_key_size_threshold =
+      arrow::random_single_real<double, double>(0, 1);
+  arrow_write_options.bloom_filter_fpp = arrow::random_single_real<double, 
double>(0, 1);
+  std::set<int64_t> bloom_filter_cols;
+  for (int64_t i = 0; i < num_cols; i++) {
+    if (arrow::random_single_int<int8_t, int8_t>(0, 1) == 1) {
+      bloom_filter_cols.insert(i);
+    }
+  }
+  arrow_write_options.bloom_filter_columns = bloom_filter_cols;
+  return arrow_write_options;
+}
+
 void AssertTableWriteReadEqual(const std::shared_ptr<Table>& input_table,
                                const std::shared_ptr<Table>& 
expected_output_table,
                                const int64_t max_size = 
kDefaultSmallMemStreamSize) {
   EXPECT_OK_AND_ASSIGN(auto buffer_output_stream,
                        io::BufferOutputStream::Create(max_size));
-  EXPECT_OK_AND_ASSIGN(auto writer,
-                       
adapters::orc::ORCFileWriter::Open(buffer_output_stream.get()));
+  arrow::adapters::orc::WriteOptions write_options =
+      GenerateRandomWriteOptions(input_table->num_columns());

Review comment:
       Really thanks! Fixed.




-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to