Skip to content

Commit 7dde1de

Browse files
TimelordUKclaude
andcommitted
docs: Update roadmap with ORDER BY completion
Marked ORDER BY aggregate expressions as completed with full details. Updated transformer count from 6 to 7, reorganized priority matrix. **Completed Features:** - ✅ ORDER BY aggregate expressions (OrderByAliasTransformer) - ✅ Parser extended to support expressions in ORDER BY - ✅ Works in all execution modes (including --execute-statement) - ✅ 8 comprehensive examples with formal test coverage **Updated Priority Matrix:** - Moved ORDER BY to completed (was priority #2) - Re-prioritized remaining features - Added status column (Done, Next, Ready, Complex) **Next Priorities:** 1. DISTINCT in aggregates (high value, medium effort) 2. QUALIFY clause (nice syntax, easy effort) 3. ILIKE (trivial effort) Transformer count: 7 active (was 6) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent f387448 commit 7dde1de

1 file changed

Lines changed: 28 additions & 24 deletions

File tree

docs/SQL_FEATURE_GAPS_AND_ROADMAP.md

Lines changed: 28 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@
55
As of the execution mode unification completion, we have:
66

77
**Solid Foundation:**
8-
- Unified execution path (`StatementExecutor` used by both `-q` and `-f` modes)
9-
- 6 active preprocessor transformers (all enabled by default)
8+
- Unified execution path (`StatementExecutor` used by all modes: `-q`, `-f`, `--execute-statement`)
9+
- 7 active preprocessor transformers (all enabled by default)
1010
- WHERE/GROUP BY alias expansion
1111
- HAVING auto-aliasing
12+
- ORDER BY aggregate rewriting
1213
- Expression lifting for window functions
1314
- CTE hoisting (ready for subqueries)
1415
- IN operator optimization
@@ -70,23 +71,26 @@ GROUP BY region
7071
---
7172

7273
#### 2. Aggregate Expressions in ORDER BY
73-
**Status:** ❌ Not implemented
74+
**Status:** **COMPLETED!**
7475
**Difficulty:** Easy
7576
**Example:**
7677
```sql
7778
SELECT region, SUM(sales_amount) AS total
7879
FROM sales
7980
GROUP BY region
80-
ORDER BY SUM(sales_amount) DESC -- This should work!
81+
ORDER BY SUM(sales_amount) DESC -- Works perfectly!
8182
```
8283

83-
**Implementation Approach:**
84-
- **Transformer:** `OrderByAggregateExpander` (similar to HavingAliasTransformer)
85-
- Find aggregates in ORDER BY
86-
- Match with SELECT clause aggregates
87-
- Replace with alias or compute inline
84+
**Implementation:**
85+
-**Transformer:** `OrderByAliasTransformer` (implemented)
86+
- ✅ Extended parser to support expressions in ORDER BY
87+
- ✅ Updated AST with `OrderByItem` struct
88+
- ✅ Handles COUNT(*), all aggregates, auto-generates aliases
89+
- ✅ Works in all execution modes (fixed dependency-aware path)
90+
- ✅ See `examples/order_by_expressions.sql` with 8 examples
91+
- ✅ Formal test coverage
8892

89-
**Estimated Effort:** 1-2 days
93+
**Completed:** 2025-11-01
9094

9195
---
9296

@@ -322,27 +326,27 @@ SELECT * FROM sales WHERE region ILIKE '%north%'
322326

323327
## Implementation Priority Matrix
324328

325-
| Feature | User Value | Difficulty | SQL Standard | Priority |
326-
|---------|-----------|-----------|--------------|----------|
327-
| DISTINCT in aggregates | High | Medium | Yes | **1** |
328-
| ORDER BY aggregates | High | Easy | Yes | **2** |
329-
| QUALIFY clause | Medium | Easy | No (Snowflake) | **3** |
330-
| PIVOT/UNPIVOT | Medium | Medium | Yes (SQL:2016) | **4** |
331-
| Correlated subqueries | High | Hard | Yes | **5** |
332-
| ARRAY_AGG/STRING_AGG | Medium | Medium | Yes | **6** |
333-
| ILIKE | Low | Trivial | No (Postgres) | **7** |
334-
| SELECT * EXCLUDE | Low | Easy | No (DuckDB) | **8** |
335-
| LATERAL joins | Low | Hard | Yes | **9** |
336-
| Recursive CTEs | Low | Very Hard | Yes | **10** |
329+
| Feature | User Value | Difficulty | SQL Standard | Priority | Status |
330+
|---------|-----------|-----------|--------------|----------|--------|
331+
| ~~ORDER BY aggregates~~ | High | Easy | Yes | ~~**1**~~ | ✅ Done |
332+
| DISTINCT in aggregates | High | Medium | Yes | **1** | ⏳ Next |
333+
| QUALIFY clause | Medium | Easy | No (Snowflake) | **2** | 📋 Ready |
334+
| ILIKE | Low | Trivial | No (Postgres) | **3** | 📋 Ready |
335+
| PIVOT/UNPIVOT | Medium | Medium | Yes (SQL:2016) | **4** | 📋 Ready |
336+
| ARRAY_AGG/STRING_AGG | Medium | Medium | Yes | **5** | 📋 Ready |
337+
| SELECT * EXCLUDE | Low | Easy | No (DuckDB) | **6** | 📋 Ready |
338+
| Correlated subqueries | High | Hard | Yes | **7** | ⚠️ Complex |
339+
| LATERAL joins | Low | Hard | Yes | **8** | ⚠️ Complex |
340+
| Recursive CTEs | Low | Very Hard | Yes | **9** | ⚠️ Complex |
337341

338342
## Next Steps
339343

340344
### Immediate (1-2 weeks)
341345
1. ✅ Complete execution mode unification (Phases 0-3) - **DONE!**
342346
2. ✅ Document all transformers - **DONE!**
343347
3. ✅ Create `examples/expander_rewriters.sql` - **DONE!**
344-
4. **NEXT:** Implement DISTINCT in aggregates (`DistinctAggregateLifter`)
345-
5. **NEXT:** Implement ORDER BY aggregate expansion
348+
4. Implement ORDER BY aggregate expansion - **DONE!** (2025-11-01)
349+
5. **NEXT:** Choose from quick wins below
346350

347351
### Short-term (1-2 months)
348352
1. Add QUALIFY clause support

0 commit comments

Comments
 (0)