[Bug] Filter parser rejects zero floating-point literals
- Dominant language
- Java
- Stars
- 22.6k
- Forks
- 12k
- Avg merge
- 3d 1h
- Merged PRs (30d)
- 27
Description
## Runtime platform environment
macOS; reproduced with `SelectorParser` in the `filter` module.
## RocketMQ version
Branch: `develop`
Git commit: `fd0c95920e0deac96ce2ae27442747cc5e65e930`
## JDK Version
Eclipse Temurin 17.0.19+10
## Describe the Bug
`ConstantExpression.createFloat` uses `Double.MIN_VALUE` as the lower bound. In Java this constant is the smallest positive non-zero value, not the most negative finite value, so the valid literal `0.0` is rejected.
## Steps to Reproduce
1. Parse the selector expression `a = 0.0`.
2. Evaluate it with property `a` equal to `0.0`.
3. Observe a runtime error stating that `0.0` is less than `4.9E-324`.
## What Did You Expect to See?
The parser should accept zero and other finite negative floating-point literals within the `double` range.
## What Did You See Instead?
The parser throws while creating the zero constant.
## Additional Context
The finite lower bound should be `-Double.MAX_VALUE`; positive and negative infinity remain outside the accepted range.
Contributor guide
Research direction
Start in the filter module with SelectorParser and ConstantExpression.createFloat, then reproduce the selector expression `a = 0.0` on the reported Java environment. Verify that zero and finite negative floating-point literals within the double range are accepted while positive and negative infinity remain rejected. Done means the runtime error no longer occurs for the reported zero-valued property.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 76/100