zhangyue19921010 opened a new issue, #11104:
URL: https://github.com/apache/paimon/issues/11104
### Search before asking
- [x] I searched in the issues and found no report of this overlapping
row-ID range overflow.
### Paimon version
Master / 2.2-SNAPSHOT at `68023de1160c16a67dd839c638ba817de23a9212`.
### Compute Engine
Java API, JDK 11.0.18.
### Minimal reproduce step
1. Create an append table with `data-evolution.enabled=true`,
`row-tracking.enabled=true`, `bucket=-1`, and no primary key.
2. Write ten rows with integer values `0..9` in two separate commits:
`0..4`, then `5..9`. The resulting files have row-ID ranges starting at 0 and 5.
3. Read through the Java API with this predicate over the row type including
`_ROW_ID`:
```java
Predicate filter = PredicateBuilder.or(
builder.between(rowIdIndex, 0L, Long.MAX_VALUE),
builder.equal(rowIdIndex, 0L));
```
This is equivalent to `_ROW_ID BETWEEN 0 AND 9223372036854775807 OR _ROW_ID
= 0`. All stored row IDs are ordinary finite values.
The original master returns only `0..4`. A table-level regression using this
fixture fails with expected `[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]`, actual `[0, 1, 2,
3, 4]`.
### What doesn't meet your expectations?
The predicate matches all ten rows, so the read should return `0..9`.
`Range.sortAndMergeOverlap(..., true)` evaluates `current.to + 1` before
checking overlap. For `[0, Long.MAX_VALUE]` and `[0, 0]`, the addition
overflows, leaving overlapping ranges separate. Their ends are no longer
monotonic, and `RowRangeIndex` can reject files whose first row ID is positive.
### Anything else?
Two focused unit regressions and the two-commit Data Evolution table
regression fail on unchanged production code at the SHA above. Checking overlap
before adjacency fixes all three.
### Are you willing to submit a PR?
- [x] I'm willing to submit a PR!
--
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]