MCPcopy Create free account
hub / github.com/apache/arrow / StatisticsReadArray

Function StatisticsReadArray

cpp/src/parquet/arrow/arrow_statistics_test.cc:290–314  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

288
289namespace {
290::arrow::Result<std::shared_ptr<::arrow::Array>> StatisticsReadArray(
291 std::shared_ptr<::arrow::DataType> data_type, std::shared_ptr<::arrow::Array> array,
292 std::shared_ptr<WriterProperties> writer_properties = default_writer_properties(),
293 const ArrowReaderProperties& reader_properties = default_arrow_reader_properties()) {
294 auto schema = ::arrow::schema({::arrow::field("column", data_type)});
295 auto record_batch = ::arrow::RecordBatch::Make(schema, array->length(), {array});
296 ARROW_ASSIGN_OR_RAISE(auto sink, ::arrow::io::BufferOutputStream::Create());
297 const auto arrow_writer_properties =
298 parquet::ArrowWriterProperties::Builder().store_schema()->build();
299 ARROW_ASSIGN_OR_RAISE(auto writer,
300 FileWriter::Open(*schema, ::arrow::default_memory_pool(), sink,
301 writer_properties, arrow_writer_properties));
302 ARROW_RETURN_NOT_OK(writer->WriteRecordBatch(*record_batch));
303 ARROW_RETURN_NOT_OK(writer->Close());
304 ARROW_ASSIGN_OR_RAISE(auto buffer, sink->Finish());
305
306 auto reader =
307 ParquetFileReader::Open(std::make_shared<::arrow::io::BufferReader>(buffer));
308 ARROW_ASSIGN_OR_RAISE(auto file_reader,
309 FileReader::Make(::arrow::default_memory_pool(),
310 std::move(reader), reader_properties));
311 std::shared_ptr<::arrow::ChunkedArray> chunked_array;
312 ARROW_RETURN_NOT_OK(file_reader->ReadColumn(0, &chunked_array));
313 return chunked_array->chunk(0);
314}
315
316template <typename ArrowType, typename MinMaxType>
317void TestStatisticsReadArray(std::shared_ptr<::arrow::DataType> arrow_type) {

Callers

nothing calls this directly

Calls 11

store_schemaMethod · 0.80
fieldFunction · 0.70
schemaFunction · 0.50
MakeFunction · 0.50
BuilderFunction · 0.50
lengthMethod · 0.45
buildMethod · 0.45
WriteRecordBatchMethod · 0.45
CloseMethod · 0.45
ReadColumnMethod · 0.45

Tested by

no test coverage detected