my-ship-it opened a new issue, #1950:
URL: https://github.com/apache/cloudberry/issues/1950
### Apache Cloudberry version
main branch (recent build, assert-enabled)
### What happened
On an assert-enabled build, the Postgres planner (not ORCA) hits an
assertion in cost estimation when an OR clause mixes a predicate on the outer
side of a LEFT JOIN with a `BETWEEN SYMMETRIC` range predicate on the nullable
inner side:
```
FailedAssertion("pselec >= 0.0 && pselec <= 1.0", costsize.c:5436)
```
The range selectivity computed for the inner-side `BETWEEN SYMMETRIC` under
the outer join ends up above 1.0. On a non-assert build this would silently
produce a bad row estimate instead of crashing.
Found by SQLancer.
### What you think should happen instead
Selectivity must be clamped to [0, 1] and the query should return a count
without crashing.
### How to reproduce
```sql
CREATE TABLE m1(c0 inet);
CREATE TABLE m2(c0 inet);
INSERT INTO m2 VALUES ('88.147.138.141'), ('76.163.212.11'),
('214.10.65.144');
ANALYZE m1, m2;
SELECT COUNT(*) FROM ONLY m1 LEFT OUTER JOIN m2 ON true
WHERE (m1.c0 IS NOT NULL)
OR (m2.c0 BETWEEN SYMMETRIC '75.175.243.19' AND '230.9.216.68');
-- FailedAssertion("pselec >= 0.0 && pselec <= 1.0", costsize.c:5436)
```
### Operating System
Linux
### Anything else
Found while running SQLancer against Cloudberry. See the related [DISCUSS]
thread on dev@ about adopting SQLancer for continuous testing.
### Are you willing to submit PR?
- [x] Yes, I am willing to submit a PR!
### Code of Conduct
- [x] I agree to follow this project's [Code of
Conduct](https://www.apache.org/foundation/policies/conduct)
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]