yiwenmu1 opened a new issue, #11666:
URL: https://github.com/apache/rocketmq/issues/11666
## Before Creating the Bug Report
- [x] This report describes a reproducible bug.
- [x] I searched the repository’s issues, pull requests and discussions for
equality with missing properties, SQL92 null comparisons and `doCreateEqual`.
- [x] The reproducer runs against the filter module in the RocketMQ
repository.
## Runtime platform environment
macOS 27.2.1, Apple Silicon (aarch64).
## RocketMQ version
`develop`, commit `19352a24679337276e041f67307c6d284dd48de9` (Maven project
version 5.5.1).
## JDK Version
Amazon Corretto 8u514, Apache Maven 3.9.12.
## Describe the Bug
For a message containing only `region=east`, the SQL92 filter `region <>
backup` matches, while `backup <> region` rejects the same message. Comparing
two absent properties with `backup = other` also matches.
## Steps to Reproduce
Run the following in a test in the `filter` module. The context contains one
property and has no `backup` or `other` entry.
```java
EvaluationContext message = new EmptyEvaluationContext() {
@Override
public Object get(String key) {
return "region".equals(key) ? "east" : null;
}
};
System.out.println(SelectorParser.parse("region <>
backup").matches(message));
System.out.println(SelectorParser.parse("backup <>
region").matches(message));
System.out.println(SelectorParser.parse("backup = other").matches(message));
```
`EvaluationContext` and `EmptyEvaluationContext` are in
`org.apache.rocketmq.filter.expression`. `SelectorParser` is in
`org.apache.rocketmq.filter.parser`.
## What Did You Expect to See?
All three expressions should evaluate to SQL `UNKNOWN` and `matches()`
should return `false`. The filtering guide describes the expected result for an
absent custom message attribute. [Message
filtering](https://rocketmq.apache.org/docs/featureBehavior/07messagefilter/)
## What Did You See Instead?
The program prints `true`, `false`, `true`. Calling `evaluate()` instead
returns `true`, `null`, `true`. The explicit presence checks `region IS NOT
NULL` and `backup IS NULL` both return `true`, as expected.
## Additional Context
I also reproduced this with the existing `SqlFilterIT` push and pull tests.
I used `TAGS IN ('TagA', 'TagB') OR TAGS <> backup` and sent 16 messages per
tag for `TagA`, `TagB` and `TagC`. None had the `backup` property. Both
consumers received all 48 messages, including the 16 with `TagC`. The expected
count was 32.
OpenAI Codex assisted with identifying the comparison, preparing the
reproducer and running the tests locally.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]