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

Function StatisticsReadArray

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

Source from the content-addressed store, hash-verified

185
186namespace {
187::arrow::Result<std::shared_ptr<::arrow::Array>> StatisticsReadArray(
188 std::shared_ptr<::arrow::DataType> data_type, std::shared_ptr<::arrow::Array> array,
189 std::shared_ptr<WriterProperties> writer_properties = default_writer_properties(),
190 const ArrowReaderProperties& reader_properties = default_arrow_reader_properties()) {
191 auto schema = ::arrow::schema({::arrow::field("column", data_type)});
192 auto record_batch = ::arrow::RecordBatch::Make(schema, array->length(), {array});
193 ARROW_ASSIGN_OR_RAISE(auto sink, ::arrow::io::BufferOutputStream::Create());
194 const auto arrow_writer_properties =
195 parquet::ArrowWriterProperties::Builder().store_schema()->build();
196 ARROW_ASSIGN_OR_RAISE(auto writer,
197 FileWriter::Open(*schema, ::arrow::default_memory_pool(), sink,
198 writer_properties, arrow_writer_properties));
199 ARROW_RETURN_NOT_OK(writer->WriteRecordBatch(*record_batch));
200 ARROW_RETURN_NOT_OK(writer->Close());
201 ARROW_ASSIGN_OR_RAISE(auto buffer, sink->Finish());
202
203 auto reader =
204 ParquetFileReader::Open(std::make_shared<::arrow::io::BufferReader>(buffer));
205 ARROW_ASSIGN_OR_RAISE(auto file_reader,
206 FileReader::Make(::arrow::default_memory_pool(),
207 std::move(reader), reader_properties));
208 std::shared_ptr<::arrow::ChunkedArray> chunked_array;
209 ARROW_RETURN_NOT_OK(file_reader->ReadColumn(0, &chunked_array));
210 return chunked_array->chunk(0);
211}
212
213template <typename ArrowType, typename MinMaxType>
214void 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