Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Null Param Repository Queries #399

Closed
edridudi opened this issue Mar 23, 2024 · 0 comments
Closed

Support for Null Param Repository Queries #399

edridudi opened this issue Mar 23, 2024 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@edridudi
Copy link

Steps to Reproduce:

  1. Use the Below Repository and Entity:
@Repository
public interface RedisUtxoRepository extends RedisDocumentRepository<RedisAddressUtxoEntity, String> {

    Optional<List<RedisAddressUtxoEntity>> findByOwnerAddrAndTxHashNull(String ownerAddress);
}
@Data
@Document
@NoArgsConstructor
@EqualsAndHashCode(callSuper = false)
@AllArgsConstructor(access = AccessLevel.PROTECTED)
public class RedisAddressUtxoEntity extends RedisBlockAwareEntity {

    @Id
    private String id;

    @Indexed
    private String txHash;

    @Indexed
    private Integer outputIndex;
    private Long slot;
    private String blockHash;
    private Integer epoch;

    @Indexed
    private String ownerAddr;
    private String ownerAddrFull;
    private String ownerStakeAddr;
    private String ownerPaymentCredential;
    private String ownerStakeCredential;
    private BigInteger lovelaceAmount;
    @Type(JsonType.class)
    private List<Amt> amounts;
    private String dataHash;
    private String inlineDatum;
    private String scriptRef;
    private String referenceScriptHash;
    private Boolean isCollateralReturn;
}
  1. Run redisUtxoRepository.findByOwnerAddrAndTxHashNull(address)

Actual Result:

java.lang.IndexOutOfBoundsException: toIndex = 1
	at java.base/java.util.AbstractList.subListRangeCheck(AbstractList.java:509) ~[na:na]
	at java.base/java.util.ArrayList.subList(ArrayList.java:1190) ~[na:na]
	at com.redis.om.spring.repository.query.RediSearchQuery.lambda$prepareQuery$16(RediSearchQuery.java:604) ~[redis-om-spring-0.8.9.jar:na]
	at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197) ~[na:na]
	at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1708) ~[na:na]
	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509) ~[na:na]
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499) ~[na:na]
	at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921) ~[na:na]
	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[na:na]
	at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:682) ~[na:na]
	at com.redis.om.spring.repository.query.RediSearchQuery.lambda$prepareQuery$17(RediSearchQuery.java:608) ~[redis-om-spring-0.8.9.jar:na]
	at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197) ~[na:na]
	at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1708) ~[na:na]
	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509) ~[na:na]
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499) ~[na:na]
	at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921) ~[na:na]
	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[na:na]
	at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:682) ~[na:na]
	at com.redis.om.spring.repository.query.RediSearchQuery.prepareQuery(RediSearchQuery.java:612) ~[redis-om-spring-0.8.9.jar:na]
	at com.redis.om.spring.repository.query.RediSearchQuery.executeQuery(RediSearchQuery.java:381) ~[redis-om-spring-0.8.9.jar:na]
	at com.redis.om.spring.repository.query.RediSearchQuery.execute(RediSearchQuery.java:360) ~[redis-om-spring-0.8.9.jar:na]
	at org.springframework.data.repository.core.support.RepositoryMethodInvoker.doInvoke(RepositoryMethodInvoker.java:170) ~[spring-data-commons-3.2.2.jar:3.2.2]
	at org.springframework.data.repository.core.support.RepositoryMethodInvoker.invoke(RepositoryMethodInvoker.java:158) ~[spring-data-commons-3.2.2.jar:3.2.2]
	at org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.doInvoke(QueryExecutorMethodInterceptor.java:164) ~[spring-data-commons-3.2.2.jar:3.2.2]
	at org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.invoke(QueryExecutorMethodInterceptor.java:143) ~[spring-data-commons-3.2.2.jar:3.2.2]
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184) ~[spring-aop-6.1.3.jar:6.1.3]
	at org.springframework.data.projection.DefaultMethodInvokingMethodInterceptor.invoke(DefaultMethodInvokingMethodInterceptor.java:70) ~[spring-data-commons-3.2.2.jar:3.2.2]
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184) ~[spring-aop-6.1.3.jar:6.1.3]
	at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:97) ~[spring-aop-6.1.3.jar:6.1.3]
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184) ~[spring-aop-6.1.3.jar:6.1.3]
	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:220) ~[spring-aop-6.1.3.jar:6.1.3]
	at jdk.proxy2/jdk.proxy2.$Proxy184.findByOwnerAddrAndTxHashNull(Unknown Source) ~[na:na]
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103) ~[na:na]
	at java.base/java.lang.reflect.Method.invoke(Method.java:580) ~[na:na]
	at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:351) ~[spring-aop-6.1.3.jar:6.1.3]
	at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:196) ~[spring-aop-6.1.3.jar:6.1.3]
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163) ~[spring-aop-6.1.3.jar:6.1.3]
	at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:137) ~[spring-tx-6.1.3.jar:6.1.3]
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184) ~[spring-aop-6.1.3.jar:6.1.3]
	at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:97) ~[spring-aop-6.1.3.jar:6.1.3]
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184) ~[spring-aop-6.1.3.jar:6.1.3]
	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:220) ~[spring-aop-6.1.3.jar:6.1.3]
	at jdk.proxy2/jdk.proxy2.$Proxy184.findByOwnerAddrAndTxHashNull(Unknown Source) ~[na:an]
	

Note:
same happens for Optional<List<RedisAddressUtxoEntity>> findByOwnerAddrAndTxHashIsNull(String ownerAddress); method

@bsbodden bsbodden self-assigned this Mar 24, 2024
@bsbodden bsbodden added bug Something isn't working and removed bug Something isn't working labels Mar 24, 2024
@bsbodden bsbodden added the enhancement New feature or request label Apr 5, 2024
@bsbodden bsbodden changed the title IndexOutOfBounds on Null Parameter Query Support for Null Param Repository Queries Apr 5, 2024
bsbodden added a commit to bsbodden/redis-om-spring that referenced this issue Apr 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants