wgtmac commented on code in PR #880:
URL: https://github.com/apache/iceberg-cpp/pull/880#discussion_r3789218992


##########
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 actually aligns with the Java implementation: 
https://github.com/apache/iceberg/blob/main/parquet/src/main/java/org/apache/iceberg/data/parquet/BaseParquetReaders.java#L229-L240
   
   I think the issue is that we don't have the ability to check if two CRS are 
logically equivalent.



-- 
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]

Reply via email to