feat: implement BETWEEN, IN, LIKE, IS NULL operators in WHERE clause#117
feat: implement BETWEEN, IN, LIKE, IS NULL operators in WHERE clause#117ajitpratap0 merged 2 commits intomainfrom
Conversation
- Add BETWEEN/NOT BETWEEN expression parsing with AND keyword handling - Add IN/NOT IN expression parsing with parenthesized value lists - Add LIKE/NOT LIKE/ILIKE pattern matching operators - Add IS NULL/IS NOT NULL postfix operators - Handle NOT prefix properly for negated operators - Update parser_coverage_test.go expectations (5 tests now pass) - Add comprehensive operators_test.go with 14 test cases SQL-99 compliance improvements for comparison predicates. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
|
Claude finished @ajitpratap0's task —— View job Code Review Complete ✅Todo List
Review FeedbackThis is a well-implemented PR that adds crucial SQL operator support. Here's my detailed analysis: ✅ Strengths1. Code Quality & Architecture
2. SQL-99 Compliance
3. Test Coverage
4. AST Design
|
Address PR review comment about NOT token handling breaking valid SQL.
Changes:
- Add peekToken() helper for look-ahead without advancing position
- Fix parseComparisonExpression() to only consume NOT when followed by
BETWEEN, LIKE, ILIKE, or IN operators
- Add NOT case in parsePrimaryExpression() for standalone boolean negation
(e.g., WHERE NOT active)
This properly handles all NOT use cases:
- NOT LIKE: WHERE name NOT LIKE '%Admin%'
- NOT BETWEEN: WHERE price NOT BETWEEN 10 AND 100
- NOT IN: WHERE status NOT IN ('cancelled', 'deleted')
- Boolean negation: WHERE NOT active AND name LIKE '%'
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Addressed Review CommentsFixed the HIGH priority issue with NOT token handling in commit 0fe4507. Changes Made:
Test Results:All 7 NOT-related test cases now pass: All parser tests pass with race detection ✅ |
|
Claude finished @ajitpratap0's task —— View job Code Review Complete ✅ Todo List
Comprehensive Review FeedbackThis updated PR successfully addresses the critical NOT token handling issue identified in the previous review. Here's my detailed analysis: ✅ Major Improvements from Fix1. Excellent NOT Token Handling Fix
2. Dual NOT Handling Strategy
✅ Code Quality & Architecture1. Follows Repository Guidelines
2. SQL-99 Compliance
3. AST Design Excellence
✅ Test Coverage Assessment1. Comprehensive Test Suite (operators_test.go)
2. Updated Coverage Tests
|
Address NOT token handling issue (same fix as PR #117). Changes: - Add peekToken() helper for look-ahead without advancing position - Fix parseComparisonExpression() to only consume NOT when followed by BETWEEN, LIKE, ILIKE, or IN operators - Update NOT case in parsePrimaryExpression() to use UnaryExpression with parseComparisonExpression for proper precedence This properly handles all NOT use cases: - NOT LIKE: WHERE name NOT LIKE '%Admin%' - NOT BETWEEN: WHERE price NOT BETWEEN 10 AND 100 - NOT IN: WHERE status NOT IN ('cancelled', 'deleted') - Boolean negation: WHERE NOT active AND name LIKE '%' - NOT EXISTS: WHERE NOT EXISTS (SELECT ...) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This PR significantly improves SQL parsing capabilities with comprehensive subquery support and expression parsing, now rebased on top of PR #117's BETWEEN/IN/LIKE operators with the NOT token fix. ### Parser Features - Add subquery support in WHERE clause (scalar subqueries) - Add EXISTS / NOT EXISTS subquery expressions - Add IN / NOT IN with subquery support - Add ANY / ALL subquery operators (= ANY, > ALL, etc.) - Add CASE expression parsing (simple and searched forms) - Add NULL literal support - Add parenthesized expression handling - Includes all operators from PR #117 with NOT fix ### AST Changes - Add SubqueryExpression for scalar subqueries - Add AnyExpression for expr op ANY (subquery) - Add AllExpression for expr op ALL (subquery) - Update InExpression to support both value lists and subqueries ### Compatibility Improvement - **Before**: ~24% of real-world SQL queries parsed successfully - **After**: **94.6%** of test queries parse successfully 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
…d) (#118) This PR significantly improves SQL parsing capabilities with comprehensive subquery support and expression parsing, now rebased on top of PR #117's BETWEEN/IN/LIKE operators with the NOT token fix. ### Parser Features - Add subquery support in WHERE clause (scalar subqueries) - Add EXISTS / NOT EXISTS subquery expressions - Add IN / NOT IN with subquery support - Add ANY / ALL subquery operators (= ANY, > ALL, etc.) - Add CASE expression parsing (simple and searched forms) - Add NULL literal support - Add parenthesized expression handling - Includes all operators from PR #117 with NOT fix ### AST Changes - Add SubqueryExpression for scalar subqueries - Add AnyExpression for expr op ANY (subquery) - Add AllExpression for expr op ALL (subquery) - Update InExpression to support both value lists and subqueries ### Compatibility Improvement - **Before**: ~24% of real-world SQL queries parsed successfully - **After**: **94.6%** of test queries parse successfully 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Ajit Pratap Singh <ajitpratapsingh@Ajits-Mac-mini.local> Co-authored-by: Claude <noreply@anthropic.com>
Summary
Changes
parseComparisonExpression()with new operators (+123 lines)SQL-99 Compliance
This PR implements SQL-99 comparison predicates:
Test Plan
Examples
🤖 Generated with Claude Code