Altinity / Altinity/altinity-sql-browser
[sup] Parameters: forward natively server-side, else strict {name:Type} renderer + parity test
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- TypeScript
- Estrellas
- 8
- Forks
- 2
- Merge medio
- 1 h 34 min
- PR fusionados (30 d)
- 6
Descripción
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().
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
Comienza con runQuery y la ruta de solicitud /api/cluster/{id}/query; después revisa core/param-serialize.ts y el escáner de ocurrencias existente. Primero registra si está disponible el reenvío nativo; si no lo está, implementa el renderizador estricto especificado y verifica la lista de comprobación de aceptación, incluida la paridad de resultados, tipos y toTypeName() con el comportamiento nativo de param_*.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- sql, typescript
- Área
- backend-api-design, databases
- Tipo de issue
- Nueva funcionalidad
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Estado de actividad
- Tranquilo
- Claridad
- Bastante claro
- Aptitud para principiantes
- 35/100