ClickHouse / ClickHouse/clickhouse-java

R2DBC client: ClickHouseResult map implementation logs but doesn't propagate exceptions.

Abierto
#1,819 2 comentarios 0 reacciones 0 asignados Ver en GitHub
area:network bug r2dbc
Lenguaje dominante
Java
Estrellas
1.6k
Forks
636
Merge medio
2 d 23 h
PR fusionados (30 d)
29

Descripción

### Describe the bug
For the R2DBC client, in `ClickHouseResult` class, the `map` method implementation logs but doesn't propagate exceptions. However, in the same class the `flatMap` method implementation both logs and propagates exceptions. See code:
- https://github.com/ClickHouse/clickhouse-java/blob/dfb161bdf367b4e36d26469600a8a80172c3fb5a/clickhouse-r2dbc/src/main/java/com/clickhouse/r2dbc/ClickHouseResult.java#L62-L64
- https://github.com/ClickHouse/clickhouse-java/blob/dfb161bdf367b4e36d26469600a8a80172c3fb5a/clickhouse-r2dbc/src/main/java/com/clickhouse/r2dbc/ClickHouseResult.java#L82-L85

### Steps to reproduce
1. Execute any statement producing a`Result` object.
2. Any error triggered within the `biFunction` argument passed to `map` will be logged but not propagated. For instance, just throw a new `IllegalArgumentException`.
3. Exception is logged but not propagated.

### Expected behaviour
Unpropagated exceptions highly increases the chances of errors being unnoticed, unless logs are observed or analysed.

The expected behaviour is propagating the exception, like `flatMap` method does.

### Code example
```java
import io.r2dbc.spi.ConnectionFactory;
import reactor.core.publisher.Mono;

public class ClickHouseRepository {

ConnectionFactory connectionFactory;

Mono example() {
return Mono.from(connectionFactory.create())
.flatMapMany(connection -> connection.createStatement("SELECT 1").execute())
.map(result -> result.map((row, rowMetadata) -> new IllegalArgumentException()))
.then();
}
}

```
### Error log

```
Provided function caused exception: IllegalArgumentException
```

However, exception is just logged and not propagated.

### Configuration
#### Environment
* Client version: 0.6.5.
* Language version: Java.
* OS: Mac, Linux.

#### ClickHouse server
* ClickHouse Server version: 24.3.8.13.
* ClickHouse Server non-default settings, if any: N/A.
* `CREATE TABLE` statements for tables involved: N/A.
* Sample data for all these tables, use [clickhouse-obfuscator](https://github.com/ClickHouse/ClickHouse/blob/master/programs/obfuscator/Obfuscator.cpp#L42-L80) if necessary: N/A.

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

Comienza en clickhouse-r2dbc/src/main/java/com/clickhouse/r2dbc/ClickHouseResult.java, comparando la implementación de map en las líneas referenciadas con flatMap. Reproduce el ejemplo proporcionado con una biFunction que lance IllegalArgumentException y verifica que la excepción se propague en lugar de solo registrarse.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
java
Área
api, database
Tipo de issue
Error
Dificultad
2/5
Tiempo estimado
1-3 horas
Estado de actividad
Estancado
Claridad
Bien especificado
Aptitud para principiantes
45/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.