Repository navigation
Description
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:
clickhouse-java/clickhouse-r2dbc/src/main/java/com/clickhouse/r2dbc/ClickHouseResult.java
Lines 62 to 64 in dfb161b
} catch (Exception e) { log.error("Provided function caused exception:", e); } clickhouse-java/clickhouse-r2dbc/src/main/java/com/clickhouse/r2dbc/ClickHouseResult.java
Lines 82 to 85 in dfb161b
} catch (Exception e) { log.error("Provided function caused exception:", e); return Mono.error(e); }
Steps to reproduce
- Execute any statement producing a
Resultobject. - Any error triggered within the
biFunctionargument passed tomapwill be logged but not propagated. For instance, just throw a newIllegalArgumentException. - 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
import io.r2dbc.spi.ConnectionFactory;
import reactor.core.publisher.Mono;
public class ClickHouseRepository {
ConnectionFactory connectionFactory;
Mono<Void> 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 TABLEstatements for tables involved: N/A.- Sample data for all these tables, use clickhouse-obfuscator if necessary: N/A.
Activity
github-actions commentedon Jan 10, 2026
This issue has been automatically marked as stale because it has not had activity in the last year. It will be closed in 30 days if no further activity occurs. Please feel free to leave a comment if you believe the issue is still relevant. Thank you for your contributions!
andrescrz commentedon Jan 12, 2026
Hi @chernser any update about the issue that I reported here? Thanks a lot.
polyglotAI-bot commentedon Nov 28, 2026
Recommendation: Keep open — fix needed
A fix is needed in
ClickHouseResult.map; no open PR changes its error handling.main: Reproduced on main — a throw drops that row, a failingrow.getdrops all rows, and each result completes with no error;flatMapsignals the error.ClickHouseResultfor response leaks, notmap.Result.flatMapand readResult.RowSegment.row(): the run shows that it signals the error.Analysis: Confirmed:
ClickHouseResult.java:59-64onmaincatches everyExceptionof the function, logs it, and does not callsink.error. So the row is dropped and the publisher completes normally. An exception of the driver's ownRow.get(ClickHouseRow.java:45) inside the function is hidden the same way.Reproduction: complete program and output
Changed from the issue's steps: the function throws the exception (the issue's example returns it); added a
row.getcase and aflatMapcontrast.Output on
main(8480ca001), ClickHouse 26.11.4.11:Automated triage by Polyglot AI. A maintainer makes the final decision.