[ https://issues.apache.org/jira/browse/IGNITE-17051?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17579833#comment-17579833 ]
Pavel Pereslegin commented on IGNITE-17051: ------------------------------------------- [~PetrovMikhail], merged to the master branch, thanks for the contribution! > Incorrect parsing of 'IN' clause in IgniteQueryGenerator > -------------------------------------------------------- > > Key: IGNITE-17051 > URL: https://issues.apache.org/jira/browse/IGNITE-17051 > Project: Ignite > Issue Type: Bug > Components: springdata > Reporter: Ilya Shishkov > Assignee: Mikhail Petrov > Priority: Major > Labels: ise > Attachments: IncorrectInOperator.patch > > > If you create JPA-repository method with with 'IN' operator (eg. > findBySecondName{*}In{*}), it should be parsed in correct SQL form, but when > such repository method is called, below error occurs: > {code:java} > Syntax error in SQL statement "SELECT ""PersonCache"".""PERSON""._KEY, > ""PersonCache"".""PERSON""._VAL FROM PERSON WHERE ((PERSON.SECONDNAME IN > ?[*])) "; expected "("; SQL statement: > SELECT "PersonCache"."PERSON"._KEY, "PersonCache"."PERSON"._VAL FROM Person > WHERE ((Person.secondName IN ?)) [42001-197] > at > org.apache.ignite.internal.processors.cache.IgniteCacheProxyImpl.query(IgniteCacheProxyImpl.java:861) > at > org.apache.ignite.internal.processors.cache.GatewayProtectedCacheProxy.query(GatewayProtectedCacheProxy.java:420) > at > org.apache.ignite.springdata.proxy.IgniteNodeCacheProxy.query(IgniteNodeCacheProxy.java:90) > at > org.apache.ignite.springdata.repository.query.IgniteRepositoryQuery.execute(IgniteRepositoryQuery.java:348) > at > org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.doInvoke(RepositoryFactorySupport.java:619) > at > org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:606) > at > org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) > at > org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:95) > at > org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) > at > org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:212) > at com.sun.proxy.$Proxy51.findBySecondNameIn(Unknown Source) > at > org.apache.ignite.springdata.IgniteSpringDataCrudSelfTest.testGetPersonsBySecondNameInList(IgniteSpringDataCrudSelfTest.java:453) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) > at java.lang.reflect.Method.invoke(Method.java:498) > at > org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) > at > org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) > at > org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) > at > org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) > at > org.apache.ignite.testframework.junits.GridAbstractTest$6.run(GridAbstractTest.java:2434) > at java.lang.Thread.run(Thread.java:748) > {code} > Here is a reproducer patch (apply to master of ignite-extensions): > [^IncorrectInOperator.patch]. It contains two tests for single argument and > for list of arguments. > It seems, that {{IgniteQueryGenerator}} incorrectly handles {{IN}} (and > {{{}NOT IN{}}}) operator [1], because if you place '?' between parenthesis, > error will disappear for single argument. > But there is another problem after addition of parenthesis: if Collection is > passed as argument below error will occur: > {code:java} > General error: "class org.apache.ignite.IgniteCheckedException: Runtime > failure on bounds: [lower=IndexSearchRowImpl > [rowHnd=org.apache.ignite.internal.processors.query.h2.index.QueryIndexRowHandler@6183d0d9], > upper=IndexSearchRowImpl > [rowHnd=org.apache.ignite.internal.processors.query.h2.index.QueryIndexRowHandler@6183d0d9]]"; > SQL statement: > SELECT > "PersonCache".__Z0._KEY __C0_0, > "PersonCache".__Z0._VAL __C0_1 > FROM "PersonCache".PERSON __Z0 > WHERE __Z0.SECONDNAME = ?1 [50000-197] > at > org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.executeSqlQuery(IgniteH2Indexing.java:900) > at > org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.executeSqlQueryWithTimer(IgniteH2Indexing.java:987) > at > org.apache.ignite.internal.processors.query.h2.twostep.GridMapQueryExecutor.onQueryRequest0(GridMapQueryExecutor.java:471) > at > org.apache.ignite.internal.processors.query.h2.twostep.GridMapQueryExecutor.onQueryRequest(GridMapQueryExecutor.java:284) > at > org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.onMessage(IgniteH2Indexing.java:2237) > at > org.apache.ignite.internal.processors.query.h2.twostep.GridReduceQueryExecutor$1.applyx(GridReduceQueryExecutor.java:157) > at > org.apache.ignite.internal.processors.query.h2.twostep.GridReduceQueryExecutor$1.applyx(GridReduceQueryExecutor.java:152) > at > org.apache.ignite.internal.util.lang.IgniteInClosure2X.apply(IgniteInClosure2X.java:38) > at > org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.send(IgniteH2Indexing.java:2362) > at > org.apache.ignite.internal.processors.query.h2.twostep.GridReduceQueryExecutor.send(GridReduceQueryExecutor.java:1201) > at > org.apache.ignite.internal.processors.query.h2.twostep.GridReduceQueryExecutor.query(GridReduceQueryExecutor.java:463) > at > org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing$7.iterator(IgniteH2Indexing.java:1848) > at > org.apache.ignite.internal.processors.cache.QueryCursorImpl.iter(QueryCursorImpl.java:102) > at > org.apache.ignite.internal.processors.cache.query.RegisteredQueryCursor.iter(RegisteredQueryCursor.java:91) > at > org.apache.ignite.internal.processors.cache.QueryCursorImpl.iterator(QueryCursorImpl.java:92) > at > org.apache.ignite.internal.processors.query.QueryKeyValueIterable.iterator(QueryKeyValueIterable.java:43) > at > org.apache.ignite.internal.processors.cache.QueryCursorImpl.iter(QueryCursorImpl.java:102) > at > org.apache.ignite.internal.processors.cache.QueryCursorImpl.getAll(QueryCursorImpl.java:124) > at > org.apache.ignite.springdata.repository.query.IgniteRepositoryQuery.transformQueryCursor(IgniteRepositoryQuery.java:640) > at > org.apache.ignite.springdata.repository.query.IgniteRepositoryQuery.execute(IgniteRepositoryQuery.java:360) > at > org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.doInvoke(RepositoryFactorySupport.java:619) > at > org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:606) > at > org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) > at > org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:95) > at > org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) > at > org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:212) > at com.sun.proxy.$Proxy53.findBySecondNameIn(Unknown Source) > at > org.apache.ignite.springdata.IgniteSpringDataCrudSelfTest.testGetPersonsBySecondNameInList(IgniteSpringDataCrudSelfTest.java:453) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) > at java.lang.reflect.Method.invoke(Method.java:498) > at > org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) > at > org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) > at > org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) > at > org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) > at > org.apache.ignite.testframework.junits.GridAbstractTest$6.run(GridAbstractTest.java:2434) > at java.lang.Thread.run(Thread.java:748) > Caused by: org.h2.jdbc.JdbcSQLException: Внутренняя ошибка: "class > org.apache.ignite.IgniteCheckedException: Runtime failure on bounds: > [lower=IndexSearchRowImpl > [rowHnd=org.apache.ignite.internal.processors.query.h2.index.QueryIndexRowHandler@6183d0d9], > upper=IndexSearchRowImpl > [rowHnd=org.apache.ignite.internal.processors.query.h2.index.QueryIndexRowHandler@6183d0d9]]" > {code} > It should be documented or fixed. > *Links:* > # > [https://github.com/apache/ignite-extensions/blob/master/modules/spring-data-ext/spring-data/src/main/java/org/apache/ignite/springdata/repository/query/IgniteQueryGenerator.java#L258] -- This message was sent by Atlassian Jira (v8.20.10#820010)