import type { Expr, Projection } from "../ir/ir.js"; import type { SchemaProvider } from "../qualify/schema-provider.js"; import { type ResolvedSource, type Scope, type ScopeTree } from "../scope/scope.js"; export interface Origin { /** The base table this column ultimately comes from (multipart name parts). */ table: string[]; /** The column in that base table. */ column: string; } export interface ColumnLineage { /** The output column name. */ output: string; /** The base-table columns it derives from, deduped. Empty for a pure literal/constant. */ origins: Origin[]; /** The projection that produced this output, when one exists (reference into the frozen IR). * Absent for schema-expanded star outputs with no projection node. */ projection?: Projection; } /** Lineage of a query's output columns: each output → the base-table columns it derives from. */ export declare function lineage(tree: ScopeTree, schema: SchemaProvider): ColumnLineage[]; /** The base-table origins of a single expression (e.g. a projection or a column reference). */ export declare function originsOf(expr: Expr, scope: Scope, schema: SchemaProvider): Origin[]; /** The origins of `column` exposed by a source — a base table is a leaf; a derived relation * recurses into the projection (or source) that produces the column. Exported so the per-hop * lineage walk (src/lineage/hops.ts) can defer pipe/lateral/graphtable/pivot sources — the ones * it has no hop model for — to this exact shared origin walk, so the two walks can't drift. */ export declare function columnOrigins(src: ResolvedSource, column: string, schema: SchemaProvider, seen: Set): Origin[];