Csaba Ringhofer has uploaded a new patch set (#27). ( https://gerrit.cloudera.org/24536 )
Change subject: IMPALA-15162: Add GEOMETRY column support for Iceberg and Parquet ...................................................................... IMPALA-15162: Add GEOMETRY column support for Iceberg and Parquet Enable GEOMETRY columns in Iceberg v3 tables. Geometry values are stored as WKB in Parquet BYTE_ARRAY with GeometryType logical type annotation. Limitations: - Always uses default CRS (OGC:CRS84); rejects columns with non-default CRS on read (IMPALA-15169). - Does not write or read bounding rectangle statistics (Parquet geometry covering/stats) (see IMPALA-15163) Frontend changes: - IcebergSchemaConverter: map GEOMETRY <-> Types.GeometryType, store as "binary" in HMS since it has no native geometry type. - TableDef and the ALTER TABLE statements (AlterTableAddColsStmt, AlterTableAlterColStmt, AlterTableReplaceColsStmt) share a single check that allows GEOMETRY columns for Iceberg v3 tables. - checkGeometryNotInResult logic moved from QueryStmt to AnalysisContext to only apply it on top level queries, allowing using geometries in UPDATE, MERGE and OPTIMIZE. Backend (Parquet) changes: - Write Parquet GeometryType logical type annotation with default crs="OGC:CRS84". - Validate logical type and CRS on Parquet read. COMPUTE STATS for GEOMETRY columns: - Treated like BINARY: no NDV, but null count and byte size are collected and stored to HMS as BINARY column stats (HMS has no geometry type yet). - Byte size uses the bytes() builtin for the real WKB size; length() is avoided because it means spatial length for geometry in some engines (PostGIS ST_Length vs ST_MemSize). Patch Iceberg's HiveSchemaUtil in the shaded jar to handle GEOMETRY/GEOGRAPHY types (maps to "binary"). Without this, every HMS metadata commit (CREATE, INSERT, ALTER) throws UnsupportedOperationException. Based on Iceberg 1.11.0. Also pushed a PR to fix this in Iceberg: https://github.com/apache/iceberg/pull/17112 Note that writing "unknown" works with latest Hive dependency, but breaks Trino interop as it doesn't know about "unknown" type yet. Tests: - Unit test for patched HiveSchemaUtil conversion. - Integration tests: CREATE, INSERT, SELECT round-trip, UPDATE, DELETE, MERGE, OPTIMIZE, ALTER TABLE ADD/DROP COLUMNS, ST_* function usage. - COMPUTE STATS reports the real WKB byte size for a geometry column (MAX/AVG SIZE via bytes()). - Verify that Parquet files written by Impala don't have statistics for GEOMETRY columns. - Verify that Impala rejects Iceberg tables with non-default CRS. - Hive interop test confirming Hive rejects GEOMETRY columns. - Trino interop test: Impala and Trino can read geometry columns written by the other. Assisted-by: Claude Opus 4.6 Change-Id: I32d8c12a6b71708646fbfc06a6dd8f7aaf4f5e6b --- M be/src/exec/parquet/hdfs-parquet-table-writer.cc M be/src/exec/parquet/parquet-metadata-utils.cc M bin/jenkins/critique-gerrit-review.py M fe/src/main/java/org/apache/impala/analysis/AlterTableAddColsStmt.java M fe/src/main/java/org/apache/impala/analysis/AlterTableAlterColStmt.java M fe/src/main/java/org/apache/impala/analysis/AlterTableReplaceColsStmt.java M fe/src/main/java/org/apache/impala/analysis/AnalysisContext.java M fe/src/main/java/org/apache/impala/analysis/ColumnDef.java M fe/src/main/java/org/apache/impala/analysis/ComputeStatsStmt.java M fe/src/main/java/org/apache/impala/analysis/QueryStmt.java M fe/src/main/java/org/apache/impala/analysis/SelectStmt.java M fe/src/main/java/org/apache/impala/analysis/SetOperationStmt.java M fe/src/main/java/org/apache/impala/analysis/TableDef.java M fe/src/main/java/org/apache/impala/analysis/UpdateStmt.java M fe/src/main/java/org/apache/impala/catalog/ColumnStats.java M fe/src/main/java/org/apache/impala/catalog/Type.java M fe/src/main/java/org/apache/impala/service/CatalogOpExecutor.java M fe/src/main/java/org/apache/impala/util/IcebergSchemaConverter.java M fe/src/main/java/org/apache/impala/util/IcebergUtil.java M fe/src/test/java/org/apache/impala/analysis/AnalyzeDDLTest.java A fe/src/test/java/org/apache/impala/util/IcebergHiveSchemaUtilTest.java M java/shaded-deps/impala-iceberg-runtime/pom.xml A java/shaded-deps/impala-iceberg-runtime/src/main/java/org/apache/iceberg/hive/HiveSchemaUtil.java A testdata/workloads/functional-query/queries/QueryTest/iceberg-geometry.test A testdata/workloads/functional-query/queries/QueryTest/iceberg-trino-interop-geometry.test M tests/custom_cluster/test_iceberg_trino_interop.py M tests/query_test/test_geospatial_functions.py M tests/query_test/test_iceberg.py M tests/util/iceberg_util.py 29 files changed, 1,276 insertions(+), 100 deletions(-) git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/36/24536/27 -- To view, visit https://gerrit.cloudera.org/24536 To unsubscribe, visit https://gerrit.cloudera.org/settings Gerrit-Project: Impala-ASF Gerrit-Branch: master Gerrit-MessageType: newpatchset Gerrit-Change-Id: I32d8c12a6b71708646fbfc06a6dd8f7aaf4f5e6b Gerrit-Change-Number: 24536 Gerrit-PatchSet: 27 Gerrit-Owner: Csaba Ringhofer <[email protected]> Gerrit-Reviewer: Arnab Karmakar <[email protected]> Gerrit-Reviewer: Balazs Hevele <[email protected]> Gerrit-Reviewer: Csaba Ringhofer <[email protected]> Gerrit-Reviewer: Impala Public Jenkins <[email protected]> Gerrit-Reviewer: Jason Fehr <[email protected]> Gerrit-Reviewer: Zoltan Borok-Nagy <[email protected]>
