ClickHouse / ClickHouse/clickhouse-java

POJO serializer cannot handle nested custom objects with Nested types

Ouverte
#2,709 1 commentaire 0 réactions 0 personnes assignées Voir sur GitHub
client-api-v2 feature-request
Langage dominant
Java
Étoiles
1.6k
Forks
636
Merge moyen
2 j 23 h
PR mergées (30 j)
29

Description

## Description

The POJO serializer cannot serialize nested custom objects when using ClickHouse `Nested` data types. It expects flattened List fields matching the flattened column names but doesn't traverse nested object graphs.

### Steps to reproduce
1. Create a POJO with a nested custom object field (e.g., `Address address`)
2. Define ClickHouse table with `Nested` type (e.g., `address Nested(street String, city String)`)
3. Attempt to insert POJO using client.insert()

See PR #2708 for complete working example.

### Error Log or Exception StackTrace

```
[main] INFO com.clickhouse.examples.client_v2.POJO2DbWriter - Table initialized. Registering class.
[main] WARN com.clickhouse.client.api.serde.POJOSerDe - No getter method found for column: addressstreet
[main] WARN com.clickhouse.client.api.serde.POJOSerDe - No setter method found for column: addressstreet
[main] WARN com.clickhouse.client.api.serde.POJOSerDe - No getter method found for column: addresscity
[main] WARN com.clickhouse.client.api.serde.POJOSerDe - No setter method found for column: addresscity
Exception in thread "main" java.lang.IllegalArgumentException: No serializer found for column 'address.street'. Did you forget to register it?
at com.clickhouse.client.api.Client.insert(Client.java:1238)
at com.clickhouse.examples.client_v2.POJO2DbWriter.flush(POJO2DbWriter.java:94)
at com.clickhouse.examples.client_v2.POJO2DbWriter.submit(POJO2DbWriter.java:89)
at com.clickhouse.examples.client_v2.Main.main(Main.java:59)
```

### Expected Behaviour

POJO serializer should traverse nested object graphs and call `getAddress().getStreet()` when encountering nested custom objects.

### Configuration

#### Environment
* Client version: main branch
* Language version: Java 17
* OS: macOS

#### ClickHouse Server
* ClickHouse Server version: latest (Docker image)

Guide de contribution

Ouvrir le guide de contribution

Piste de recherche

Start with com.clickhouse.client.api.serde.POJOSerDe and reproduce the case described in PR #2708, using the POJO2DbWriter insertion path shown in the stack trace. Done means a POJO containing an Address object can be inserted into a Nested address column without missing getter or serializer errors.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
java
Domaine
databases
Type d'issue
Bug
Difficulté
4/5
Temps estimé
3-5 jours
Activité
À l'abandon
Clarté
Plutôt claire
Accessibilité débutants
42/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.