chore: auto-commit (12 archivos)
- playground/tables/CMakeLists.txt - playground/tables/data_table.cpp - playground/tables/data_table_logic.cpp - playground/tables/data_table_logic.h - playground/tables/self_test.cpp - playground/tables/tql.cpp - playground/tables/viz.cpp - playground/tables/viz.h - playground/tables/llm_anthropic.cpp - playground/tables/llm_anthropic.h - ... Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
// tql_to_sql: emite SQL DuckDB equivalente a una pipeline TQL State.
|
||||
// Pure. Sin DuckDB linkado. Solo string emit + validacion.
|
||||
// Ver issue 0080 + docs/TQL.md (seccion "SQL transpile subset").
|
||||
#pragma once
|
||||
|
||||
#include "data_table_logic.h"
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace tql_to_sql {
|
||||
|
||||
struct SqlEmit {
|
||||
std::string sql; // SELECT/CTE chain DuckDB
|
||||
std::vector<std::string> params; // bound values posicionales (?)
|
||||
std::vector<std::string> warnings; // soft issues (col not found, etc.)
|
||||
std::string error; // si non-empty, emit fallo
|
||||
};
|
||||
|
||||
// Pure: emite SQL DuckDB equivalente a stages 0..active del state.
|
||||
// `tables` provee schema (headers/types/name) de cada TableInput. El caller
|
||||
// es responsable de hidratar las tablas en DuckDB con esos nombres.
|
||||
// `up_to_stage = -1` => state.active_stage.
|
||||
SqlEmit emit_sql(const data_table::State& state,
|
||||
const std::vector<data_table::TableInput>& tables,
|
||||
int up_to_stage = -1);
|
||||
|
||||
// Pure: valida que `formula` (cuerpo Lua de un derived col) este dentro del
|
||||
// subset SQL-transpilable. Si valido, retorna true. Si no, false + razon
|
||||
// concreta en `error_out` (categoria + token problematico).
|
||||
// Ver docs/TQL.md#sql-transpile-subset.
|
||||
bool is_transpilable(const std::string& formula, std::string& error_out);
|
||||
|
||||
// Pure: transpila formula Lua subset -> SQL expression. Si fuera de subset,
|
||||
// retorna "" y rellena `error_out`. Asume is_transpilable retornaria true.
|
||||
// `in_headers` necesario para resolver `[col]` refs y emitir identifier
|
||||
// SQL apropiado (quoted si tiene char especial).
|
||||
std::string transpile_expr(const std::string& formula,
|
||||
const std::vector<std::string>& in_headers,
|
||||
std::string& error_out);
|
||||
|
||||
} // namespace tql_to_sql
|
||||
Reference in New Issue
Block a user