-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
Mark Paluch opened DATAREDIS-711 and commented
Executing a Lua script returning a List response fails during response processing (e.g. applying map or filter operators) with a ClassCastException because of single element emission instead of emitting a list.
Lettuce emits each element of the returned list as single element but the generic types between RedisScript and the returned Flux do not match:
Code to reproduce:
DefaultRedisScript<List> script = new DefaultRedisScript<>();
script.setResultType(List.class);
Flux<List> flow = template.execute(script,…).map(list -> …);Additionally, generics do not work well with types accepting generics, it would make sense to be able to write the following code:
DefaultRedisScript<List<Integer>> script = new DefaultRedisScript<>();
script.setResultType(List.class);
Flux<List> flow = template.execute(script,…);NB: execute requires probably a different name and setResultType should be declared like <S extends T> void setResultType(Class<S> resultType)
Affects: 2.0 GA (Kay)
Referenced from: pull request #282
Backported to: 2.0.1 (Kay SR1)