csringhofer commented on code in PR #17112:
URL: https://github.com/apache/iceberg/pull/17112#discussion_r3535281627


##########
hive-metastore/src/test/java/org/apache/iceberg/hive/TestHiveSchemaUtil.java:
##########
@@ -212,6 +213,44 @@ public void testVariantTypeConvertToHiveSchema() {
     assertThat(hiveSchema).containsExactly(new FieldSchema("variant_field", 
"unknown", null));
   }
 
+  @Test
+  public void testGeometryTypeConvertToHiveSchema() {
+    Schema schema = new Schema(optional(0, "geometry_field", 
Types.GeometryType.crs84()));
+    List<FieldSchema> hiveSchema = HiveSchemaUtil.convert(schema);
+    assertThat(hiveSchema).containsExactly(new FieldSchema("geometry_field", 
"binary", null));
+  }
+
+  @Test
+  public void testGeometryTypeWithCustomCrsConvertToHiveSchema() {
+    Schema schema = new Schema(optional(0, "geometry_field", 
Types.GeometryType.of("EPSG:3857")));
+    List<FieldSchema> hiveSchema = HiveSchemaUtil.convert(schema);

Review Comment:
   Yes, this is intentional because Hive metastore has no GEOMETRY/GEOGRAPHY 
type, so also can't store these extra parameters. In Impala the source of truth 
for the schema is Iceberg, the table in HMS is only used of its Iceberg related 
properties. This is also how  we plan to handled VARIANT. It is currently 
mapped to "unknown", which would be also a possibility in this patch, but I 
think that "binary" is generic enough - a byte array and we don't claim 
anything about its content.
   
   For other systems: I checked Impala interop only with Trino. AFAIK Trino 
reimplemented some parts of Hive catalog, including HiveSchemaUtil. They map 
geometry to binary here: 
https://github.com/trinodb/trino/blob/bfe1a8e05dead169fcc6400c903e39d3379e52c5/plugin/trino-iceberg/src/main/java/io/trino/plugin/iceberg/util/HiveSchemaUtil.java#L46



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