arvindksi274-ksolves opened a new pull request, #4412: URL: https://github.com/apache/cassandra/pull/4412
Fix CASSANDRA-20154: BETWEEN operator returns wrong results when start bound is greater than end bound. This PR fixes a bug where queries like `SELECT * FROM table WHERE column BETWEEN 5 AND 3` incorrectly return rows instead of an empty result set. The issue was caused by Cassandra automatically sorting BETWEEN bounds, which violates SQL standards. **Changes made:** - Modified SimpleRestriction.java to preserve user-specified bound order for BETWEEN queries - Updated ClusteringColumnRestrictions.java to properly handle BETWEEN on first clustering column - Added tests to verify inverted BETWEEN bounds now return empty results **Before:** `WHERE pk BETWEEN 5 AND 3` would return rows between 3 and 5 **After:** `WHERE pk BETWEEN 5 AND 3` correctly returns no rows (as per SQL standard) patch by Arvind Kandpal for CASSANDRA-20154 Co-authored-by: Arvind Kandpal <[email protected]> -- 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]

