manuzhang commented on code in PR #880:
URL: https://github.com/apache/iceberg-cpp/pull/880#discussion_r3744229714
##########
src/iceberg/parquet/parquet_schema_util.cc:
##########
@@ -105,16 +292,39 @@ void SelectAnchorColumnIfEmpty(
}
}
+Status ValidateGeospatialParquetType(const Type& expected_type,
+ const ::parquet::arrow::SchemaField&
parquet_field,
+ const ::parquet::ColumnDescriptor& descr)
{
+ if (parquet_field.field->type()->id() != ::arrow::Type::BINARY) {
+ return InvalidSchema("Cannot read Iceberg type {} from non-binary Parquet
field",
+ expected_type);
+ }
+ if (descr.logical_type() == nullptr) {
+ return InvalidSchema("Missing Parquet leaf column metadata for Iceberg
type {}",
+ expected_type);
+ }
+ if (descr.physical_type() != ::parquet::Type::BYTE_ARRAY) {
+ return InvalidSchema("Iceberg type {} requires Parquet BYTE_ARRAY",
expected_type);
+ }
+ if (expected_type.type_id() == TypeId::kGeometry) {
Review Comment:
This (and the following) validates only whether the logical type is GEOMETRY
or GEOGRAPHY; it does not compare the logical-type parameters with the expected
Iceberg type. As a result, the reader currently accepts cases such as:
```
geometry(EPSG:3857) projected as geometry(OGC:CRS84)
geography(OGC:CRS84, spherical) projected as geography(EPSG:4326, karney)
```
Because WKB does not encode the CRS or edge-interpolation algorithm, this
can silently interpret the same bytes using different semantics.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]