anitnilay20 / anitnilay20/thoth
File query: sorting (ORDER BY via DuckDB)
- Lingua principale
- Rust
- Stelle
- 70
- Fork
- 5
- Merge medio
- 10h 33m
- PR unite (30g)
- 2
Descrizione
## Context
Part of the DuckDB file query engine epic (#147). Depends on #148 (FileQueryEngine) and #149 (query editor UI). The original plan proposed a custom sort algorithm with Rayon — with DuckDB this is standard SQL `ORDER BY`.
## What this covers
Multi-column sorting of file records through DuckDB's `ORDER BY`, surfaced in two ways:
### 1. SQL query editor (typed)
```sql
SELECT * FROM data ORDER BY age DESC
SELECT * FROM data ORDER BY category ASC, price DESC
SELECT * FROM data WHERE status = 'active' ORDER BY created_at DESC
SELECT * FROM data ORDER BY LOWER(name) ASC -- case-insensitive
SELECT * FROM data ORDER BY price NULLS LAST
```
### 2. Column header click (table view)
Clicking a column header in the data-view table generates and runs an `ORDER BY` query automatically. Click once for ASC, again for DESC, third click clears sort. Header shows ↑ / ↓ indicator.
DuckDB handles: numeric vs string comparison, NULL ordering (`NULLS FIRST` / `NULLS LAST`), multi-column precedence, case-insensitive sort via `LOWER()`, type coercion. No custom comparator needed.
## What needs building
- Column header click → generates `ORDER BY col ASC/DESC` and re-runs current query
- Sort state indicator (↑/↓) on column headers in data-view table
- Preserve `WHERE` clause when sort changes (compose the full SQL from current filter + new sort)
## Acceptance criteria
- [ ] Column header click sorts by that column ASC then DESC on successive clicks
- [ ] Sort indicator shown on active sort column(s)
- [ ] Multi-column sort works (click with modifier key, or type `ORDER BY a ASC, b DESC`)
- [ ] Existing `WHERE` clause preserved when sort changes
- [ ] `NULLS FIRST` / `NULLS LAST` configurable (toggle in column header menu or query)
- [ ] Works for native JSON, native CSV, and plugin-ingested formats
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Valutazione
Questa issue non è ancora stata valutata.