altimate-code
altimate-code copied to clipboard
[BUG]: column answer mishandles some column names at the edges
Description
impact_analysis's column answer and dbt_lineage mishandle some column names, which a review of #1710 found. No model is ever reported unaffected; these are wrong names, "has no column" errors, or a missing column.
- A real column named
_1that aselect *child inherits is dropped from the child:columnReach(child, "_1")throws "has no column". - A real alias named like the engine's own
_Nloses its edge when the engine also gives a_col_Nfor the same source column. select *, val as idsettles without theid_1DuckDB makes, soid_1throws "has no column".- A
COLUMNS()call anywhere in the SQL makes a real"col_\0"alias disappear. - On Postgres and Redshift an unaliased cast of a column (
amount::numeric) is named after the column, but the answer labels it_col_1, so the trace stops there. - DuckDB names a join's second
valval_1;dbt_lineagefor aselect *child misses it. - The text line "K of them with no sign (not traced)" can read as "no effect".
Plugins
None needed; the CLI (altimate tool run impact_analysis and dbt_lineage).
OpenCode version
main after #1710.
Steps to reproduce
- DuckDB:
fdocumentsid, amount;r = select id, amount as _1 from f;child = select * from r. - Run
columnReach(child, "_1"): it throws "child has no column _1". - The other shapes above reproduce the same way, each with its one-line model.
Screenshot and/or share link
No response
Operating System
Any
Terminal
Any
Deferred from #1754, for a follow-up. None is a regression against the current release; each under-traces or mislabels edge input, and nothing is reported unaffected:
- A repeat beside a qualified or CTE-wrapped star (
select f.*, val as id from f f,with q as (select *, val as id from f) select * from q) still settles, sor.id_1gives "has no column" on DuckDB, as before. Only a bare outer*is checked. - A written
_N/_col_Nis looked for anywhere in the SQL, so a table alias orWHEREcolumn with that name keeps the engine's label (a_1table alias keeps a fake_1; a_col_1relation stops a cast rename). distinct on (...)with nested parentheses, and mixed cast chains (cast(amount as numeric)::int), keep_col_N.- Aliases after
t.modor a complete interval literal (t.mod id,interval '1 day' id) aren't read. dbt_lineageshows a model's own cast edge under the engine's label whilecolumn_answernames it after the column.
Resolved in v0.12.12.