Skip to content

HIVE-30240: Iceberg: Add basic support for GEOMETRY data type - #6949

Open
difin wants to merge 1 commit into
apache:masterfrom
difin:geometry
Open

difin wants to merge 1 commit into
apache:masterfrom
difin:geometry

Conversation

@difin

@difin difin commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

Support for GEOMETRY data type and a shared base for GEOGRAPHY data type that will be developed later.

This PR implements the following aspects of the GEOMETRY data type support:

type system

GEOMETRY is a primitive type (GeospatialTypeInfo base class plus GeometryTypeInfo), with type strings like geometry and geometry('EPSG:3857').
Object inspectors and the serde, lazy and lazybinary paths support it.
The metastore's ColumnType accepts it, and non-Iceberg tables reject it.

DDL and the compiler

GEOMETRY / GEOMETRY('crs') in the grammar as a non-reserved keyword, the type string from the parse tree, and the Calcite mapping.
BINARY → GEOMETRY conversion for INSERT and CAST.
Partition columns, partition transforms and sort order are rejected.

Iceberg schema mapping

Mapping to and from Iceberg's Types.GeometryType with its CRS. Default values are rejected.

reading and writing

Iceberg object inspector, Deserializer, HiveValueConverter, vectorization and the Parquet vectorized reader.
Parquet only. ORC tables are rejected at CREATE and ALTER.
Phase 5: HiveServer2 and JDBC

TTypeId.GEOMETRY_TYPE, the Thrift Type mapping, ColumnValue/ColumnBuffer and JdbcColumn. Clients receive raw WKB as java.sql.Types.BINARY.
Added today: protocol version V13 and the JDBC and TestColumnBuffer tests.

h3. Not included (follow-ups)

  • Native GEOMETRY in Hive's ESRI ST_ functions.*
    ** The existing functions use the ESRI shape format, not WKB, so they don't accept GEOMETRY directly yet.
    ** Workaround: ST_GeomFromWKB(CAST(g AS BINARY)) to read, and CAST(ST_AsBinary(...) AS GEOMETRY) to write.
  • Spatial predicate pushdown.
    ** Iceberg already writes geometry bounding boxes for Hive writes, but Hive doesn't use them to prune files.
    ** This is blocked until Iceberg exposes spatial predicates in its public expression API.
  • GEOGRAPHY type: a separate ticket.
  • Formats: ORC isn't supported because Iceberg can't write geometry to ORC.
  • Returning the CRS to JDBC clients: clients get WKB bytes and the type name "geometry", without the CRS.

Why are the changes needed?

Iceberg v3 has GEOMETRY data type. This PR adds support for this data type in Hive.

Does this PR introduce any user-facing change?

Yes. New GEOMETRY data type that can be used in Hive for Iceberg tables.

How was this patch tested?

New unit and query tests.

@difin
difin marked this pull request as ready for review December 1, 2026 12:59
@difin difin changed the title HIVE-30240: Iceberg: Add support for GEOMETRY data type HIVE-30240: Iceberg: Add basic support for GEOMETRY data type Dec 2, 2026
@sonarqubecloud

sonarqubecloud Bot commented Dec 2, 2026

Copy link
Copy Markdown

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants