anitnilay20 / anitnilay20/thoth

File query: sorting (ORDER BY via DuckDB)

Abierto
#54 1 comentario 0 reacciones 0 asignados Ver en GitHub
enhancement feature performance priority:medium size:medium
Lenguaje dominante
Rust
Estrellas
70
Forks
5
Merge medio
10 h 33 min
PR fusionados (30 d)
2

Descripción

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

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.