Closed
Description
Please do a quick search on GitHub issues first, there might be already a duplicate issue for the one you are about to create.
If the bug is trivial, just go ahead and create the issue. Otherwise, please take a few moments and fill in the following sections:
Bug description
Environment
Spring-ai 1.0.0
Steps to reproduce
@test
public void testEQ() {
// country == "BG"
Expression exp2 = this.parser.parse("biz_id == 3L");
assertThat(exp2).isEqualTo(new Expression(EQ, new Key("biz_id"), new Value(3L)));
}
Expected behavior
Support long type parsing
Minimal Complete Reproducible example
@test
public void testEQ() {
// country == "BG"
Expression exp2 = this.parser.parse("biz_id == 3L");
assertThat(exp2).isEqualTo(new Expression(EQ, new Key("biz_id"), new Value(3L)));
}
Temporary solution
I am not familiar with antlr4, and the temporary solution is as follows:
org.springframework.ai.vectorstore.filter.FilterExpressionTextParser.FilterExpressionVisitor#visitIntegerConstant
public Filter.Operand visitIntegerConstant(FiltersParser.IntegerConstantContext ctx) {
long value = Long.parseLong(ctx.getText());
if (value > Integer.MAX_VALUE || value < Integer.MIN_VALUE) {
return new Filter.Value(value);
}
return new Filter.Value((int)value);
}