anitnilay20 / anitnilay20/thoth

File query: sorting (ORDER BY via DuckDB)

Offen
#54 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
enhancement feature performance priority:medium size:medium
Vorherrschende Sprache
Rust
Sterne
70
Forks
5
Ø Merge
10 Std. 33 Min.
Gemergte PRs (30 T.)
2

Beschreibung

## 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

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.