You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Querying SELECT 1 requires fetching the value as Integer.class, when any other numeric type should work, too.
Steps to reproduce
Run this:
System.out.println((
Flux.from(connectionFactory.create())
.flatMap(c -> c
.createStatement("select 1")
.execute())
.flatMap(it -> it.map((r, m) -> r.get(0, Byte.class)))
.collectList()
.block()
));
To produce:
Exception in thread "main" java.lang.IllegalArgumentException: Cannot decode value of type java.lang.Byte
at io.r2dbc.h2.codecs.DefaultCodecs.decode(DefaultCodecs.java:60)
at io.r2dbc.h2.H2Row.get(H2Row.java:66)
at org.jooq.testscripts.R2DBC.lambda$2(R2DBC.java:40)
at io.r2dbc.h2.H2Result.lambda$map$0(H2Result.java:67)
at reactor.core.publisher.FluxMap$MapSubscriber.onNext(FluxMap.java:106)
at reactor.core.publisher.FluxOnErrorResume$ResumeSubscriber.onNext(FluxOnErrorResume.java:79)
at reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.onNext(FluxMapFuseable.java:127)
at reactor.core.publisher.FluxIterable$IterableSubscription.slowPath(FluxIterable.java:270)
at reactor.core.publisher.FluxIterable$IterableSubscription.request(FluxIterable.java:228)
at reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.request(FluxMapFuseable.java:169)
at reactor.core.publisher.Operators$MultiSubscriptionSubscriber.set(Operators.java:2193)
at reactor.core.publisher.FluxOnErrorResume$ResumeSubscriber.onSubscribe(FluxOnErrorResume.java:74)
at reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.onSubscribe(FluxMapFuseable.java:96)
at reactor.core.publisher.FluxIterable.subscribe(FluxIterable.java:164)
at reactor.core.publisher.FluxIterable.subscribe(FluxIterable.java:86)
at reactor.core.publisher.Flux.subscribe(Flux.java:8185)
at reactor.core.publisher.FluxFlatMap$FlatMapMain.onNext(FluxFlatMap.java:426)
at reactor.core.publisher.FluxFlatMap$FlatMapMain.tryEmit(FluxFlatMap.java:543)
at reactor.core.publisher.FluxFlatMap$FlatMapInner.onNext(FluxFlatMap.java:984)
at reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.onNext(FluxMapFuseable.java:127)
at reactor.core.publisher.FluxIterable$IterableSubscription.slowPath(FluxIterable.java:270)
at reactor.core.publisher.FluxIterable$IterableSubscription.request(FluxIterable.java:228)
at reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.request(FluxMapFuseable.java:169)
at reactor.core.publisher.FluxFlatMap$FlatMapInner.onSubscribe(FluxFlatMap.java:964)
at reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.onSubscribe(FluxMapFuseable.java:96)
at reactor.core.publisher.FluxIterable.subscribe(FluxIterable.java:164)
at reactor.core.publisher.FluxIterable.subscribe(FluxIterable.java:86)
at reactor.core.publisher.Flux.subscribe(Flux.java:8185)
at reactor.core.publisher.FluxFlatMap.trySubscribeScalarMap(FluxFlatMap.java:200)
at reactor.core.publisher.FluxFlatMap.subscribeOrReturn(FluxFlatMap.java:93)
at reactor.core.publisher.Flux.subscribe(Flux.java:8171)
at reactor.core.publisher.FluxFlatMap$FlatMapMain.onNext(FluxFlatMap.java:426)
at reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.onNext(FluxMapFuseable.java:127)
at reactor.core.publisher.Operators$MonoSubscriber.complete(Operators.java:1815)
at reactor.core.publisher.MonoSupplier.subscribe(MonoSupplier.java:61)
at reactor.core.publisher.Mono.subscribe(Mono.java:4099)
at reactor.core.publisher.Mono.block(Mono.java:1702)
at org.jooq.testscripts.R2DBC.main(R2DBC.java:42)
Suppressed: java.lang.Exception: #block terminated with an error
at reactor.core.publisher.BlockingSingleSubscriber.blockingGet(BlockingSingleSubscriber.java:99)
at reactor.core.publisher.Mono.block(Mono.java:1703)
... 1 more
Expected behavior/code
This should work like it does in JDBC or other r2dbc drivers
Possible Solution
Convert the type in Java, or cast it in SQL as a workaround:
System.out.println((
Flux.from(connectionFactory.create())
.flatMap(c -> c
.createStatement("select 1")
.execute())
.flatMap(it -> it.map((r, m) -> r.get(0, Byte.class)))
.collectList()
.block()
));
The text was updated successfully, but these errors were encountered:
Bug Report
Versions
Current Behavior
Querying
SELECT 1
requires fetching the value asInteger.class
, when any other numeric type should work, too.Steps to reproduce
Run this:
To produce:
Expected behavior/code
This should work like it does in JDBC or other r2dbc drivers
Possible Solution
Convert the type in Java, or cast it in SQL as a workaround:
The text was updated successfully, but these errors were encountered: