Skip to content

EQL parser rejects array of constants in IN expressions #3835

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

Closed
afrunt opened this issue Apr 11, 2025 · 2 comments
Closed

EQL parser rejects array of constants in IN expressions #3835

afrunt opened this issue Apr 11, 2025 · 2 comments
Assignees
Labels
type: bug A general bug

Comments

@afrunt
Copy link

afrunt commented Apr 11, 2025

EqlParser cannot parse the valid EQL queries. Here are the queries

select f from FooEntity f where upper(f.name) IN ('Y', 'Basic', 'Remit')

select count(f) from FooEntity f where f.status IN (com.example.eql_bug_check.entity.FooStatus.FOO, com.example.eql_bug_check.entity.FooStatus.BAR)

Here is the example https://github.com/afrunt/eql-bug-check
I will add similar upcoming issues to this project if any

Caused by: org.springframework.data.jpa.repository.query.BadJpqlGrammarException: At 1:50 and token ''Y'', no viable alternative at input 'select f from FooEntity f where upper(f.name) IN (*'Y', 'Basic', 'Remit')'; Bad EQL grammar [select f from FooEntity f where upper(f.name) IN ('Y', 'Basic', 'Remit')]
at org.springframework.data.jpa.repository.query.BadJpqlGrammarErrorListener.syntaxError(BadJpqlGrammarErrorListener.java:53) ~[spring-data-jpa-3.4.5-20250410.122157-35.jar:3.4.5-SNAPSHOT]
at org.antlr.v4.runtime.ProxyErrorListener.syntaxError(ProxyErrorListener.java:41) ~[antlr4-runtime-4.13.0.jar:4.13.0]
at org.antlr.v4.runtime.Parser.notifyErrorListeners(Parser.java:544) ~[antlr4-runtime-4.13.0.jar:4.13.0]
at org.antlr.v4.runtime.DefaultErrorStrategy.reportNoViableAlternative(DefaultErrorStrategy.java:310) ~[antlr4-runtime-4.13.0.jar:4.13.0]
at org.antlr.v4.runtime.DefaultErrorStrategy.reportError(DefaultErrorStrategy.java:136) ~[antlr4-runtime-4.13.0.jar:4.13.0]
at org.springframework.data.jpa.repository.query.EqlParser.in_expression(EqlParser.java:5544) ~[spring-data-jpa-3.4.5-20250410.122157-35.jar:3.4.5-SNAPSHOT]
at org.springframework.data.jpa.repository.query.EqlParser.simple_cond_expression(EqlParser.java:5225) ~[spring-data-jpa-3.4.5-20250410.122157-35.jar:3.4.5-SNAPSHOT]
at org.springframework.data.jpa.repository.query.EqlParser.conditional_primary(EqlParser.java:5128) ~[spring-data-jpa-3.4.5-20250410.122157-35.jar:3.4.5-SNAPSHOT]
at org.springframework.data.jpa.repository.query.EqlParser.conditional_factor(EqlParser.java:5076) ~[spring-data-jpa-3.4.5-20250410.122157-35.jar:3.4.5-SNAPSHOT]
at org.springframework.data.jpa.repository.query.EqlParser.conditional_term(EqlParser.java:4994) ~[spring-data-jpa-3.4.5-20250410.122157-35.jar:3.4.5-SNAPSHOT]
at org.springframework.data.jpa.repository.query.EqlParser.conditional_expression(EqlParser.java:4909) ~[spring-data-jpa-3.4.5-20250410.122157-35.jar:3.4.5-SNAPSHOT]
at org.springframework.data.jpa.repository.query.EqlParser.where_clause(EqlParser.java:3368) ~[spring-data-jpa-3.4.5-20250410.122157-35.jar:3.4.5-SNAPSHOT]
at org.springframework.data.jpa.repository.query.EqlParser.select_statement(EqlParser.java:423) ~[spring-data-jpa-3.4.5-20250410.122157-35.jar:3.4.5-SNAPSHOT]
at org.springframework.data.jpa.repository.query.EqlParser.ql_statement(EqlParser.java:322) ~[spring-data-jpa-3.4.5-20250410.122157-35.jar:3.4.5-SNAPSHOT]
at org.springframework.data.jpa.repository.query.EqlParser.start(EqlParser.java:265) ~[spring-data-jpa-3.4.5-20250410.122157-35.jar:3.4.5-SNAPSHOT]
at org.springframework.data.jpa.repository.query.JpaQueryEnhancer.parse(JpaQueryEnhancer.java:101) ~[spring-data-jpa-3.4.5-20250410.122157-35.jar:3.4.5-SNAPSHOT]
at org.springframework.data.jpa.repository.query.JpaQueryEnhancer$EqlQueryParser.(JpaQueryEnhancer.java:316) ~[spring-data-jpa-3.4.5-20250410.122157-35.jar:3.4.5-SNAPSHOT]
at org.springframework.data.jpa.repository.query.JpaQueryEnhancer$EqlQueryParser.parseQuery(JpaQueryEnhancer.java:328) ~[spring-data-jpa-3.4.5-20250410.122157-35.jar:3.4.5-SNAPSHOT]
at org.springframework.data.jpa.repository.query.JpaQueryEnhancer.forEql(JpaQueryEnhancer.java:177) ~[spring-data-jpa-3.4.5-20250410.122157-35.jar:3.4.5-SNAPSHOT]
at org.springframework.data.jpa.repository.query.QueryEnhancerFactory.forQuery(QueryEnhancerFactory.java:70) ~[spring-data-jpa-3.4.5-20250410.122157-35.jar:3.4.5-SNAPSHOT]
at org.springframework.data.jpa.repository.query.StringQuery.(StringQuery.java:98) ~[spring-data-jpa-3.4.5-20250410.122157-35.jar:3.4.5-SNAPSHOT]
at org.springframework.data.jpa.repository.query.StringQuery.(StringQuery.java:77) ~[spring-data-jpa-3.4.5-20250410.122157-35.jar:3.4.5-SNAPSHOT]
at org.springframework.data.jpa.repository.query.ExpressionBasedStringQuery.(ExpressionBasedStringQuery.java:65) ~[spring-data-jpa-3.4.5-20250410.122157-35.jar:3.4.5-SNAPSHOT]
at org.springframework.data.jpa.repository.query.AbstractStringBasedJpaQuery.(AbstractStringBasedJpaQuery.java:84) ~[spring-data-jpa-3.4.5-20250410.122157-35.jar:3.4.5-SNAPSHOT]
at org.springframework.data.jpa.repository.query.SimpleJpaQuery.(SimpleJpaQuery.java:65) ~[spring-data-jpa-3.4.5-20250410.122157-35.jar:3.4.5-SNAPSHOT]
at org.springframework.data.jpa.repository.query.JpaQueryFactory.fromMethodWithQueryString(JpaQueryFactory.java:49) ~[spring-data-jpa-3.4.5-20250410.122157-35.jar:3.4.5-SNAPSHOT]
at org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$DeclaredQueryLookupStrategy.resolveQuery(JpaQueryLookupStrategy.java:174) ~[spring-data-jpa-3.4.5-20250410.122157-35.jar:3.4.5-SNAPSHOT]
at org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$CreateIfNotFoundQueryLookupStrategy.resolveQuery(JpaQueryLookupStrategy.java:254) ~[spring-data-jpa-3.4.5-20250410.122157-35.jar:3.4.5-SNAPSHOT]
at org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$AbstractQueryLookupStrategy.resolveQuery(JpaQueryLookupStrategy.java:99) ~[spring-data-jpa-3.4.5-20250410.122157-35.jar:3.4.5-SNAPSHOT]
at org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.lookupQuery(QueryExecutorMethodInterceptor.java:116) ~[spring-data-commons-3.4.5-20250410.121244-29.jar:3.4.5-SNAPSHOT]
... 29 common frames omitted

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Apr 11, 2025
@mp911de mp911de self-assigned this Apr 11, 2025
@mp911de mp911de added type: bug A general bug and removed status: waiting-for-triage An issue we've not yet triaged labels Apr 11, 2025
@mp911de mp911de added this to the 3.3.11 (2024.0.11) milestone Apr 14, 2025
@mp911de
Copy link
Member

mp911de commented Apr 14, 2025

That's fixed now.

@afrunt
Copy link
Author

afrunt commented Apr 14, 2025

@mp911de awesome, thank you! 🤝
Will continue to play with it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug A general bug
Projects
None yet
Development

No branches or pull requests

3 participants