Fix WHERE clause evaluating only first condition#181
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
There was a problem hiding this comment.
Code Review
This pull request updates the matchesConditions function to correctly evaluate multiple WHERE conditions by iterating through all conditions rather than returning after the first one. It also adds unit tests to verify both matching and non-matching scenarios with multiple conditions. A review comment suggests refactoring the logic to use early returns within the switch statement, which would eliminate the need for the matches variable and make the code more idiomatic.
786f6ba to
4aeb248
Compare
|
Hi @shurarama, thanks for the contribution! Please squash your commits an use a conventional commit message that starts with |
matchesConditions() returned immediately after checking the first condition instead of continuing to evaluate remaining AND conditions. This caused queries with multiple WHERE clauses on system_schema tables to silently ignore all conditions after the first one.
4aeb248 to
f960215
Compare
Fixes #183
Summary
matchesConditions()inmem_table/in_mem_select.goreturns immediately after evaluating the first WHERE condition, silently ignoring all subsequent AND conditionsfalsewhen a condition fails,trueonly after all conditions passAffected queries
Any query with multiple WHERE conditions on
system_schema.*tables, e.g.:Previously only
keyspace_namewas evaluated;table_namewas ignored.Test plan
multiple where conditions— verifies both conditions are appliedmultiple where conditions no match— verifies mismatch on second condition returns no rows