Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge 'Support nested parenthesized conditional expressions in transl…
…ator' from Preston Thorpe This PR fixes queries like: ```sql SELECT count(*) FROM users WHERE ((age > 25 OR age < 18) AND (city = 'Boston' OR state = 'MA')); ``` Previously we would return `7516` rows instead of `146`, due to disregarding the final `AND` from within the nested `OR` conditions, unconditionally short circuiting when a TRUE is found in an OR expression without any surrounding relevant context. or: ```sql SELECT * FROM users WHERE (((age > 18 AND city = 'New Mario') OR age = 92) AND city = 'Lake Paul'); ``` Previously we would incorrectly return the top row: ``` 9984|Leah|Russell|..|..|6733 Weber Crossing|New Mario|SC|57707|78 9989|Timothy|Harrison|..|..|782 Wright Harbors|Lake Paul|ID|52330|92 ``` Added localized jump targets for OR expressions within AND blocks to prevent premature short-circuiting and `parent operator` to condition metadata to trigger them. If parent operator should instead be another function param on `translate_conditional_expr`, instead of a field in condition_metadata, let me know and I can change it. EDIT: sorry I realize I should have included the other cleanup changes in a different PR. I will fix this after work Reviewed-by: Jussi Saurio <[email protected]> Closes #633
- Loading branch information