| 349 | } |
| 350 | |
| 351 | std::string GeoStatistics::ToString() const { |
| 352 | if (!is_valid()) { |
| 353 | return "<GeoStatistics> invalid"; |
| 354 | } |
| 355 | |
| 356 | std::stringstream ss; |
| 357 | ss << "<GeoStatistics>"; |
| 358 | |
| 359 | std::string dim_label("xyzm"); |
| 360 | auto dim_valid = dimension_valid(); |
| 361 | auto dim_empty = dimension_empty(); |
| 362 | auto lower = lower_bound(); |
| 363 | auto upper = upper_bound(); |
| 364 | |
| 365 | for (int i = 0; i < kMaxDimensions; i++) { |
| 366 | ss << " " << dim_label[i] << ": "; |
| 367 | if (!dim_valid[i]) { |
| 368 | ss << "invalid"; |
| 369 | } else if (dim_empty[i]) { |
| 370 | ss << "empty"; |
| 371 | } else { |
| 372 | ss << "[" << lower[i] << ", " << upper[i] << "]"; |
| 373 | } |
| 374 | } |
| 375 | |
| 376 | std::optional<std::vector<int32_t>> maybe_geometry_types = geometry_types(); |
| 377 | ss << " geometry_types: "; |
| 378 | if (maybe_geometry_types.has_value()) { |
| 379 | ss << "["; |
| 380 | std::string sep(""); |
| 381 | for (int32_t geometry_type : *maybe_geometry_types) { |
| 382 | ss << sep << geometry_type; |
| 383 | sep = ", "; |
| 384 | } |
| 385 | ss << "]"; |
| 386 | } else { |
| 387 | ss << "invalid"; |
| 388 | } |
| 389 | |
| 390 | return ss.str(); |
| 391 | } |
| 392 | |
| 393 | } // namespace parquet::geospatial |