Altinity / Altinity/altinity-sql-browser
[sup] Parameters: forward natively server-side, else strict {name:Type} renderer + parity test
Nessuno ha ancora preso questa issue.
- Lingua principale
- TypeScript
- Stelle
- 8
- Fork
- 2
- Merge medio
- 1h 34m
- PR unite (30g)
- 6
Descrizione
Part of #352. Native param_* are not forwarded by the proxy (verified UNKNOWN_QUERY_PARAMETER).
Preferred: forward params server-side (ACM-side ask)
Given tight ACM integration is a plus, the cleanest fix is to have /api/cluster/{id}/query accept a structured param map (and settings) and bind them natively in ClickHouse — no client-side SQL rewriting, full type parity. Raise with the ACM team first; if accepted, this issue reduces to wiring runQuery's params through the request body.
Fallback: strict client-side {name:Type} renderer
If native forwarding isn't available, render typed value placeholders {name:Type} (CH syntax) → SQL literals, typed values only, no free-form/identifier macros. Do not reuse core/param-serialize.ts (it targets the HTTP param_* channel: passes scalar strings raw, treats unknown types as opaque — not inline-SQL-safe or type-equivalent). Instead a separate strict renderTypedSqlExpression:
- explicit allowlist of supported type ASTs (reject unknown);
- parse compound values into structured values (never trust free-form strings);
- quote every textual component; emit explicit casts where CH semantics need them (e.g.
{x:UUID}→CAST('…' AS UUID), Date/DateTime64/Decimal/Enum/IPv4/6/large-int); - reuse the existing occurrence scanner's exact spans (ignores placeholders in literals/comments); replace right-to-left.
Acceptance
- Decision recorded: native forwarding vs. client renderer.
- If renderer: allowlisted types render +
CASTwhere needed; unsupported values fail closed. - Parity test: same query+values via native
param_*(public build) vs. this path → identical results, types, andtoTypeName().
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia con runQuery e il percorso della richiesta /api/cluster/{id}/query, quindi esamina core/param-serialize.ts e lo scanner delle occorrenze esistente. Per prima cosa annota se è disponibile il forwarding nativo; in caso contrario, implementa il renderer rigoroso specificato e verifica la checklist di accettazione, inclusa la parità di risultati, tipi e toTypeName() rispetto al comportamento nativo di param_*.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- sql, typescript
- Ambito
- backend-api-design, databases
- Tipo di issue
- Funzionalità
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Stato di attività
- Tranquilla
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100