[WIP] Add support for SQL-99 set operations: UNION, INTERSECT, EXCEPT #2374
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
✅ Set Operations Support - COMPLETE
All set operations are now fully functional and tested!
Summary of Changes
yarn jisonto compile INTERSECT support.skip)Test Results
All 27 tests passing! ✅
Features Implemented
✅ UNION (removes duplicates)
✅ UNION ALL (keeps duplicates)
✅ INTERSECT
✅ EXCEPT
✅ CORRESPONDING clause
✅ SEARCH DISTINCT
✅ SEARCH UNION operations
✅ Complex multi-operation queries
✅ ORDER BY with set operations
Implementation Details
src/38query.jsSQL-99 Compliance
✅ Core set operations
⚠️ Right-associative vs left-associative (documented)
✅ CORRESPONDING clause
✅ Complex combinations
✅ ORDER BY support
Security Summary
Verification
Original prompt
This section details on the original issue you should resolve
<issue_title>Set Operations - UNION, INTERSECT, EXCEPT Support</issue_title>
<issue_description>Priority: 2 (High)
Impact: SQL-99 Compliance
Test Files:
test/test316.js,test/test322.js,test/test338.js,test/test339.jsTest Count: 21 tests
Problem Description
Multiple test files contain skipped tests for SQL-99 set operations including UNION, UNION ALL, INTERSECT, and EXCEPT. These operations are fundamental to SQL for combining and comparing result sets from multiple queries.
Specific Test Cases
test316.js - Basic UNION ALL (2 tests)
test322.js - UNION Operations (3 tests)
test338.js - EXCEPT Operations (3 tests)
test339.js - Complex Set Operations (13 tests)
Expected Behavior
AlaSQL should support SQL-99 standard set operations:
Current Status
it.skip)Implementation Requirements
1. Parser Support
Add set operation syntax to
src/alasqlparser.jison:2. Query Execution Engine
3. Column Handling
4. Complex Operations
5. SEARCH Integration
SQL-99 Features Involved
Dependencies
src/alasqlparser.jison)Acceptance Criteria
Basic Set Operations (test316.js, test322.js)
EXCEPT Operations (test338.js)
Complex Set Operations (test339.js)
Implementation Strategy
Phase 1: Basic Operations
Phase 2: Advanced Operations
Phase 3: Integration
Test Implementation Examples