Make an object with Parquet data. Appends integer columns to the beginning (to act as indices).
| 147 | /// Make an object with Parquet data. |
| 148 | /// Appends integer columns to the beginning (to act as indices). |
| 149 | Status MakeParquetObject(const std::string& path, int num_columns, int num_rows) { |
| 150 | std::vector<std::shared_ptr<ChunkedArray>> columns; |
| 151 | FieldVector fields{ |
| 152 | field("timestamp", int64(), /*nullable=*/true, |
| 153 | key_value_metadata( |
| 154 | {{"min", "0"}, {"max", "10000000000"}, {"null_probability", "0"}})), |
| 155 | field("val", int32(), /*nullable=*/true, |
| 156 | key_value_metadata( |
| 157 | {{"min", "0"}, {"max", "1000000000"}, {"null_probability", "0"}}))}; |
| 158 | for (int i = 0; i < num_columns; i++) { |
| 159 | std::stringstream ss; |
| 160 | ss << "col" << i; |
| 161 | fields.push_back( |
| 162 | field(ss.str(), float64(), /*nullable=*/true, |
| 163 | key_value_metadata( |
| 164 | {{"min", "-1.e10"}, {"max", "1e10"}, {"null_probability", "0"}}))); |
| 165 | } |
| 166 | auto batch = random::GenerateBatch(fields, num_rows, 0); |
| 167 | ARROW_ASSIGN_OR_RAISE(std::shared_ptr<Table> table, |
| 168 | Table::FromRecordBatches({batch})); |
| 169 | |
| 170 | std::shared_ptr<io::OutputStream> sink; |
| 171 | ARROW_ASSIGN_OR_RAISE(sink, fs_->OpenOutputStream(path)); |
| 172 | RETURN_NOT_OK( |
| 173 | parquet::arrow::WriteTable(*table, arrow::default_memory_pool(), sink, num_rows)); |
| 174 | |
| 175 | return Status::OK(); |
| 176 | } |
| 177 | |
| 178 | void TearDown(const ::benchmark::State& state) override { |
| 179 | ASSERT_OK(minio_->Stop()); |
nothing calls this directly
no test coverage detected