Skip to content

Conversation

@leehaut
Copy link
Contributor

@leehaut leehaut commented Oct 23, 2025

fixed: #4705 -- FilterExpressionTextParser treats all number literals as Integer, failing on Long values

…ling on Long values

Signed-off-by: lance <leehaut@gmail.com>
…ling on Long values

Signed-off-by: lance <leehaut@gmail.com>
…ling on Long values

Signed-off-by: lance <leehaut@gmail.com>
@ericbottard
Copy link
Member

Hi @leehaut, thanks for your contribution.

I believe your PR has become irrelevant since we merged #3516.

Can you please confirm this is the case.

@leehaut
Copy link
Contributor Author

leehaut commented Oct 24, 2025

Hi @ericbottard, I tried testing with long types or hexadecimal (0x) values, and found that ANTLR always converts them to int. ANTLR cannot distinguish between int and long.
.e.g.

	@MethodSource("constantConstantProvider")
	@ParameterizedTest(name = "{index} => [{0}, expected={1}]")
	void testConstants(String expr, Object expectedValue) {
		Expression result = this.parser.parse(expr);
		assertThat(result).isEqualTo(new Expression(EQ, new Key("id"), new Value(expectedValue)));
	}

	static Stream<Arguments> constantConstantProvider() {
		return Stream.of(Arguments.of("id==" + Integer.MAX_VALUE, Integer.MAX_VALUE),
				Arguments.of("id==" + Integer.MIN_VALUE, Integer.MIN_VALUE),
				Arguments.of("id==" + Long.MAX_VALUE, Long.MAX_VALUE),
				Arguments.of("id==" + Long.MIN_VALUE, Long.MIN_VALUE), Arguments.of("id==" + 0x100, 0x100),
				Arguments.of("id==" + 1000000000000L, 1000000000000L), Arguments.of("id==" + Math.PI, Math.PI));
	}

@ericbottard
Copy link
Member

Hi,

the linked PR introduces support for longs by using the 1234L notation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

FilterExpressionTextParser treats all number literals as Integer, failing on Long values

3 participants