File tree 6 files changed +57
-5
lines changed
antlr4/org/springframework/data/jpa/repository/query
java/org/springframework/data/jpa/repository/query
test/java/org/springframework/data/jpa/repository/query
6 files changed +57
-5
lines changed Original file line number Diff line number Diff line change @@ -354,7 +354,12 @@ in_expression
354
354
355
355
in_item
356
356
: literal
357
+ | string_expression
358
+ | boolean_literal
359
+ | numeric_literal
360
+ | date_time_timestamp_literal
357
361
| single_valued_input_parameter
362
+ | conditional_expression
358
363
;
359
364
360
365
like_expression
Original file line number Diff line number Diff line change @@ -342,7 +342,12 @@ in_expression
342
342
343
343
in_item
344
344
: literal
345
+ | string_expression
346
+ | boolean_literal
347
+ | numeric_literal
348
+ | date_time_timestamp_literal
345
349
| single_valued_input_parameter
350
+ | conditional_expression
346
351
;
347
352
348
353
like_expression
Original file line number Diff line number Diff line change @@ -1189,15 +1189,23 @@ public QueryTokenStream visitIn_expression(EqlParser.In_expressionContext ctx) {
1189
1189
@ Override
1190
1190
public QueryTokenStream visitIn_item (EqlParser .In_itemContext ctx ) {
1191
1191
1192
- QueryRendererBuilder builder = QueryRenderer .builder ();
1193
-
1194
1192
if (ctx .literal () != null ) {
1195
- builder .append (visit (ctx .literal ()));
1193
+ return visit (ctx .literal ());
1194
+ } else if (ctx .string_expression () != null ) {
1195
+ return visit (ctx .string_expression ());
1196
+ } else if (ctx .boolean_literal () != null ) {
1197
+ return visit (ctx .boolean_literal ());
1198
+ } else if (ctx .numeric_literal () != null ) {
1199
+ return visit (ctx .numeric_literal ());
1200
+ } else if (ctx .date_time_timestamp_literal () != null ) {
1201
+ return visit (ctx .date_time_timestamp_literal ());
1196
1202
} else if (ctx .single_valued_input_parameter () != null ) {
1197
- builder .append (visit (ctx .single_valued_input_parameter ()));
1203
+ return visit (ctx .single_valued_input_parameter ());
1204
+ } else if (ctx .conditional_expression () != null ) {
1205
+ return visit (ctx .conditional_expression ());
1198
1206
}
1199
1207
1200
- return builder ;
1208
+ return QueryTokenStream . empty () ;
1201
1209
}
1202
1210
1203
1211
@ Override
Original file line number Diff line number Diff line change @@ -1113,8 +1113,18 @@ public QueryTokenStream visitIn_item(JpqlParser.In_itemContext ctx) {
1113
1113
1114
1114
if (ctx .literal () != null ) {
1115
1115
return visit (ctx .literal ());
1116
+ } else if (ctx .string_expression () != null ) {
1117
+ return visit (ctx .string_expression ());
1118
+ } else if (ctx .boolean_literal () != null ) {
1119
+ return visit (ctx .boolean_literal ());
1120
+ } else if (ctx .numeric_literal () != null ) {
1121
+ return visit (ctx .numeric_literal ());
1122
+ } else if (ctx .date_time_timestamp_literal () != null ) {
1123
+ return visit (ctx .date_time_timestamp_literal ());
1116
1124
} else if (ctx .single_valued_input_parameter () != null ) {
1117
1125
return visit (ctx .single_valued_input_parameter ());
1126
+ } else if (ctx .conditional_expression () != null ) {
1127
+ return visit (ctx .conditional_expression ());
1118
1128
}
1119
1129
1120
1130
return QueryTokenStream .empty ();
Original file line number Diff line number Diff line change @@ -555,6 +555,18 @@ WHERE TYPE(e) IN :empTypes
555
555
""" );
556
556
}
557
557
558
+ @ Test
559
+ void inClauseWithFunctionAndLiterals () {
560
+
561
+ assertQuery ("""
562
+ select f from FooEntity f where upper(f.name) IN ('Y', 'Basic', 'Remit')
563
+ """ );
564
+ assertQuery (
565
+ """
566
+ 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)
567
+ """ );
568
+ }
569
+
558
570
@ Test
559
571
void notEqualsForTypeShouldWork () {
560
572
Original file line number Diff line number Diff line change @@ -556,6 +556,18 @@ WHERE TYPE(e) IN :empTypes
556
556
""" );
557
557
}
558
558
559
+ @ Test
560
+ void inClauseWithFunctionAndLiterals () {
561
+
562
+ assertQuery ("""
563
+ select f from FooEntity f where upper(f.name) IN ('Y', 'Basic', 'Remit')
564
+ """ );
565
+ assertQuery (
566
+ """
567
+ 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)
568
+ """ );
569
+ }
570
+
559
571
@ Test
560
572
void notEqualsForTypeShouldWork () {
561
573
You can’t perform that action at this time.
0 commit comments