Hi community, I would like to start a discussion about STIP-42, which proposes a shared spatial data contract from MySQL-CDC to Elasticsearch/OpenSearch.
Detailed proposal: https://github.com/apache/seatunnel/issues/12923 Background SeaTunnel currently has no end-to-end contract for MySQL spatial values. MySQL-CDC receives non-null spatial values as Debezium Point or Geometry structures. The existing BYTES conversion path cannot decode these structures into a usable SeaTunnel row value. The Elasticsearch/OpenSearch sink also cannot derive geo_point or geo_shape mappings from an opaque binary schema. This means the following path is currently unsupported: MySQL-CDC -> SeaTunnel -> Elasticsearch/OpenSearch Proposed solution STIP-42 introduces a shared API-level spatial contract: - GeometryType(GeometryKind) describes the schema type and geometry kind. - Geometry contains the row-level unsigned SRID and standard 2D WKB. - MySQL-CDC converts Debezium spatial structures into this shared representation. - Elasticsearch/OpenSearch maps POINT to geo_point and the other geometry kinds to geo_shape. - The source preserves the original SRID and coordinate order. - The sink accepts SRID 4326 and does not reproject or modify coordinates. The first version supports all eight MySQL spatial types: - GEOMETRY - POINT - LINESTRING - POLYGON - MULTIPOINT - MULTILINESTRING - MULTIPOLYGON - GEOMETRYCOLLECTION It covers MySQL-CDC snapshot and binlog INSERT, UPDATE, and DELETE events. Why use a shared API type Using BYTES would leave the spatial format, geometry kind, and SRID implicit. Each downstream connector would need to understand the MySQL or Debezium representation independently. The shared GeometryType and Geometry classes provide a source- and sink-neutral contract. The API does not contain MySQL framing, Elasticsearch mapping types, GeoJSON, or a target-specific SRID policy. The first implementation is intentionally limited to MySQL-CDC and Elasticsearch/OpenSearch. Future sources and sinks may explicitly adopt the same contract after implementing and testing it; no connector gains spatial support automatically. First-version boundaries The first version supports: - MySQL-CDC schema discovery, snapshot, and binlog decoding; - Zeta schema, row, and checkpoint serialization; - Elasticsearch/OpenSearch geo_point and geo_shape mapping; - new-index mapping creation; - existing-index mapping validation before source rows are consumed; - column-level and row-level SRID validation; - checkpoint and restore behavior. The following are outside the first version: - MySQL JDBC Source adoption of GeometryType; - MySQL JDBC Sink geometry support; - coordinate reprojection; - runtime spatial schema evolution; - manual GEOMETRY schema declarations; - spatial transforms and functions; - spatial execution on Flink or Spark; - dynamic or placeholder Elasticsearch index names. Flink and Spark will reject GEOMETRY during planning before a source reader consumes rows. Geometry schemas using dynamic or placeholder index names will be rejected during sink creation because their concrete mappings cannot be validated before data is read. JDBC compatibility The current MySQL JDBC behavior remains unchanged. MySQL JDBC Source continues to expose generic GEOMETRY as BYTES. Existing MySQL-to-MySQL binary transport, TiDB catalog behavior, and the StarRocks JDBC-compatible dialect do not adopt GeometryType. This is different from MySQL-CDC: JDBC already has a usable opaque-binary transport contract, while non-null CDC spatial values have no working historical end-to-end contract. The first version therefore treats MySQL-CDC geometry as a new capability and introduces no JDBC schema migration. Zeta upgrade boundary GeometryType is transported in the Zeta job action graph, and Geometry is transported as a SeaTunnelRow field through RecordSerializer. An old cluster member does not contain these classes and cannot deserialize the new schema or row value. Spatial jobs therefore require a strict full-cluster upgrade: - the client, all masters, all workers, and any cluster member that may deserialize job or state objects must use a compatible version; - mixed-version execution of a spatial job is unsupported; - a spatial checkpoint or savepoint can only be restored on a fully upgraded cluster; - downgrading a spatial job after it has produced new state is unsupported. If this boundary is violated, failure may occur during action, task, row, or checkpoint deserialization. This is not presented as graceful pre-dispatch rejection. Non-spatial jobs do not contain GeometryType or Geometry, and this proposal does not change their existing schema, row, or checkpoint representations. Implementation organization After the STIP is accepted, the work will be divided into three dependency-ordered and independently testable slices: 1. Shared API types, Zeta serialization, Flink/Spark planning guards, and upgrade/restore tests. 2. MySQL-CDC schema mapping, Debezium decoding, metadata, and checkpoint tests. 3. Elasticsearch/OpenSearch mapping, validation, documentation, and end-to-end tests. SeaTunnel PRs are squash-merged, so I would also like community feedback on the delivery form: - one PR containing the complete dependency-ordered implementation; or - stacked PRs in which each slice can be reviewed and tested independently. No implementation PR will be opened before the STIP is accepted. Questions for the community I would particularly appreciate feedback on: 1. Is GeometryType and Geometry an appropriate shared cross-connector contract? 2. Is the MySQL-CDC-only first-version scope appropriately bounded? 3. Is preserving the existing JDBC BYTES behavior the correct compatibility decision? 4. Is the strict full-cluster upgrade boundary acceptable for the first version? 5. Should the implementation be delivered as one complete PR or dependency-ordered stacked PRs? The full serialization inventory, SRID rules, mapping validation contract, compatibility decisions, and test plan are documented in the STIP: https://github.com/apache/seatunnel/issues/12923 Related feature request: https://github.com/apache/seatunnel/issues/12832 Any feedback is welcome. Best regards, zy Tao GitHub: https://github.com/taozhiyi13
