| 121 | namespace { |
| 122 | |
| 123 | GeometryTypeAndDimensions ParseGeometryType(uint32_t wkb_geometry_type) { |
| 124 | // The number 1000 can be used because WKB geometry types are constructed |
| 125 | // on purpose such that this relationship is true (e.g., LINESTRING ZM maps |
| 126 | // to 3002). |
| 127 | uint32_t geometry_type_component = wkb_geometry_type % 1000; |
| 128 | uint32_t dimensions_component = wkb_geometry_type / 1000; |
| 129 | |
| 130 | auto min_geometry_type_value = static_cast<uint32_t>(GeometryType::kValueMin); |
| 131 | auto max_geometry_type_value = static_cast<uint32_t>(GeometryType::kValueMax); |
| 132 | auto min_dimension_value = static_cast<uint32_t>(Dimensions::kValueMin); |
| 133 | auto max_dimension_value = static_cast<uint32_t>(Dimensions::kValueMax); |
| 134 | |
| 135 | if (geometry_type_component < min_geometry_type_value || |
| 136 | geometry_type_component > max_geometry_type_value || |
| 137 | dimensions_component < min_dimension_value || |
| 138 | dimensions_component > max_dimension_value) { |
| 139 | throw ParquetException("Invalid WKB geometry type: ", wkb_geometry_type); |
| 140 | } |
| 141 | |
| 142 | return {static_cast<GeometryType>(geometry_type_component), |
| 143 | static_cast<Dimensions>(dimensions_component)}; |
| 144 | } |
| 145 | |
| 146 | } // namespace |
| 147 |
no test coverage detected