Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,11 @@ protected void doValue(Filter.Value filterValue, StringBuilder context) {
}
formattedList.append("}");

if (context.lastIndexOf("in ") == -1) {
String ctx = context.toString().trim();
boolean isInClause = ctx.endsWith(" in");
boolean isNotInClause = ctx.endsWith(" not in");

if (!isInClause && !isNotInClause) {
context.append(formattedList);
}
else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,4 +217,17 @@ public void testComplexIdentifiers() {
Assertions.assertEquals(Boolean.TRUE, parser.parseExpression(vectorExpr).getValue(context, Boolean.class));
}

@Test
void eqExpressionWithListAndKeyContainingInSpaceShouldNotUseContains() {
Filter.Expression expr = new Filter.Expression(
Filter.ExpressionType.EQ,
new Filter.Key("pin code"),
new Filter.Value(List.of("1234", "5678"))
);

String result = converter.convertExpression(expr);

Assertions.assertEquals("#metadata['pin code'] == {'1234','5678'}", result);
}

}