ClickHouse / ClickHouse/clickhouse-java

[client-v2, jdbc-v2] Add MultiPoint type support

Abierto
#3,048 1 comentario 0 reacciones 1 asignado Reclamado por @polyglotAI-bot Ver en GitHub
area:data-type enhancement
Lenguaje dominante
Java
Estrellas
1.6k
Forks
636
Merge medio
2 d 23 h
PR fusionados (30 d)
29

Descripción

Follow-up to [#2577](https://github.com/ClickHouse/clickhouse-java/issues/2577). At the time it was noted that ClickHouse has no `MultiPoint` type:

> ClickHouse doesn't support `GeometryCollection`, `MultiPoint`. Here is link for supported types https://clickhouse.com/docs/sql-reference/data-types/geo
>
> There is a `Ring` what may be a `MultiPoint`.
>
> _Originally posted by @chernser in [#2577](https://github.com/ClickHouse/clickhouse-java/issues/2577#issuecomment-3321276471)_

That has since changed on the server side. `MultiPoint` is now a first-class geo type [documented on that same page](https://clickhouse.com/docs/sql-reference/data-types/geo), defined as `Array(Point)`, and `Geometry` is documented as a common type for all the geo types listed there.

**Note on versions:** this is a heads-up, not a regression report. `MultiPoint` is not in 26.7 or earlier — I'm testing against a master/head build (`26.8.1.146`), so it should land in the next release. Filing now so client support can be in place before then.

The client already ships `Geometry` support ([#2815](https://github.com/ClickHouse/clickhouse-java/pull/2815)) for CH 25.11+, where `Geometry` became `Variant(Point, Ring, LineString, MultiLineString, Polygon, MultiPolygon)`. `MultiPoint` appears to be the one geo type left out of both the concrete-type path and that variant list.

`GeometryCollection` remains correctly out of scope — `Geometry` is the ClickHouse equivalent.

## Reproduction

```sql
CREATE TABLE geo_multipoint (mp MultiPoint) ENGINE = Memory();
INSERT INTO geo_multipoint VALUES([(0, 0), (10, 0), (10, 10), (0, 10)]);
SELECT mp, toTypeName(mp) FROM geo_multipoint;

-- via WKT, and through the unified type
SELECT readWKT('MULTIPOINT(0 0, 10 0, 10 10)') AS mp, toTypeName(mp);
CREATE TABLE geo_any (g Geometry) ENGINE = Memory();
INSERT INTO geo_any SELECT readWKT('MULTIPOINT(0 0, 10 0, 10 10)');
SELECT g, toTypeName(g) FROM geo_any;
```

**Expected:** `MultiPoint` is recognised as a geo column type and returned in the same geometry-aware representation the other geo types got after [#2581](https://github.com/ClickHouse/clickhouse-java/pull/2581), and it round-trips on insert.

**Actual:** reading a `MultiPoint` column via jdbc-v2 gives:

```
Caused by: java.lang.IllegalArgumentException: Unsupported data type: MultiPoint
```

## Proposed changes

- [ ] Add `MultiPoint` to the ClickHouse data-type enum / type parser.
- [ ] Read path: map `MultiPoint` to the same geometry representation used for `Ring` / `LineString` (both are also `Array(Point)`).
- [ ] Write path: support inserting `MultiPoint`, including via `readWKT` / WKB round-trip.
- [ ] JDBC metadata: `getColumnType` / `getColumnTypeName` / `getColumnClassName` for `MultiPoint` columns, so v2 doesn't NPE the way the types in [#2711](https://github.com/ClickHouse/clickhouse-java/issues/2711) did.
- [ ] Extend `Geometry` variant handling if the server includes `MultiPoint` in it.

## Environment

- clickhouse-java: 0.9.8
- Driver: jdbc-v2 / client-v2
- ClickHouse server: 26.8.1.146 (master/head build — not a stable release)

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.