public final class DlineageXmlProjector extends Object
DataFlowAnalyzer XML output into the same
canonical form as the Semantic IR projector.
Two projection modes:
project(String, EDbVendor) — Phase-0 single-statement
mode, consuming only the XML shapes seen in the captured 5-SQL
corpus baselines (see phase0/golden/*.dlineage.xml) and
the slice-1..57 lifts. Pinned by the slice test suite; byte-stable.projectGraph(String, EDbVendor) — US-011 whole-file mode
for the full mssql corpus shapes (procedures, variables, cursors,
temp tables, multi-statement batches, write targets, call
relationships). See its javadoc for the sink/naming rules.Any input that doesn't fit produces a ProjectorResult
carrying an ProjectorResult.UnsupportedReason; the harness
translates it into a single
DivergenceClass.UNSUPPORTED_BY_DLINEAGE divergence.
Aggregate handling — see slice-7 plan §"DlineageXmlProjector". The
COUNT(*) heuristic detects function-resultset fdd sources that include
a column="*" reference and suppresses SELECT fan-out from that
function. SUM(col)/AVG(col)/COUNT(col) retain
their fan-out.
| Modifier and Type | Class and Description |
|---|---|
static class |
DlineageXmlProjector.FanoutPolicy
|
| Modifier and Type | Method and Description |
|---|---|
static ProjectorResult |
project(String xml)
Legacy entry point — equivalent to
project(String, EDbVendor)
with vendor=null. |
static ProjectorResult |
project(String xml,
EDbVendor vendor)
Slice 43 — vendor-scoped projection entry point.
|
static ProjectorResult |
projectGraph(String xml)
Graph-mode entry point — equivalent to
projectGraph(String, EDbVendor) with vendor=null. |
static ProjectorResult |
projectGraph(String xml,
EDbVendor vendor)
US-011 — whole-file ("graph mode") projection for the full mssql
corpus shapes: procedures, variables (including cursor variables),
temp tables, multi-statement batches, INSERT / UPDATE / DELETE /
MERGE / CTAS / CREATE VIEW write targets, and
call
relationships. |
public static ProjectorResult project(String xml)
project(String, EDbVendor)
with vendor=null. Retained for callers that don't know or
don't care about the source dialect (Phase-0 harness, divergence
goldens, slice-7 comparison harness).public static ProjectorResult project(String xml, EDbVendor vendor)
vendor
parameter pins the per-vendor API contract so a future cautious
projector override can apply per-vendor name-whitelist exceptions
(e.g. PG hypothetical-set rank / dense_rank /
percent_rank / cume_dist where the WG form's XML
is structurally indistinguishable from the OVER form). Slice 43
deliberately makes no behavior change in the projector —
today the AGGREGATE_FUNCTION_NAMES /
ORDER_BY_WITHIN_GROUP_AGGREGATE_NAMES sets are vendor-
agnostic and the vendor argument is recorded but not
consulted. The byte-for-byte equivalence is enforced by
Slice43Test.projectorVendorScopeOverloadAccepts*Vendor.
Future slices that wire vendor-specific overrides MUST keep
this equivalence for callers that pass vendor=null (the
legacy project(String) delegates here with null).
The follow-up slice for PG hypothetical-set top-level admission
is the first expected consumer of the vendor parameter.
xml - dlineage XML output, must not be null/emptyvendor - source SQL dialect; may be null when the
caller has no vendor informationpublic static ProjectorResult projectGraph(String xml)
projectGraph(String, EDbVendor) with vendor=null.public static ProjectorResult projectGraph(String xml, EDbVendor vendor)
call
relationships.
Unlike project(String, EDbVendor) — which is pinned to
the Phase-0 single-terminal-SELECT contract and stays byte-stable —
graph mode projects every lineage sink in the document:
<table> or <view> (INSERT / UPDATE / MERGE /
SELECT INTO / CREATE VIEW). Output name:
<qualified-object-name>.<column> lower-cased.<variable> (SET @v = …, SELECT @v = …,
FETCH … INTO @v, cursor variables). Output name: the
variable's qualified name (plus .<column> for
multi-column record/cursor variables whose column name is not
the variable's own name).isTerminalResultsetType(String)) never
referenced as an fdd/fdr source. Output name:
<resultset-name>.<column> lower-cased (e.g.
rs-2.au_fname) so multiple statements in one file
cannot collide.The SELECT-edge BFS descends through intermediate resultsets
and variables (cross-statement flow: a value written to
@v in one statement and read in a later INSERT walks back to
the original base column). Base <table> elements (including
temp tables and type="pseudoTable" trigger pseudo-tables)
and <view> elements terminate the walk; constantTable
sources are dropped as in single mode.
Row-influence: every fdr source with
clauseType="where"/"joinCondition" (or
clause="where"/"on") anywhere in the document contributes a
FILTER / JOIN null-anchor edge resolved to base columns — graph mode
has no single "final" resultset to chain from, so the per-statement
reachability filter of single mode is intentionally replaced by
whole-document breadth.
Ignored without error: <procedure>, <process>,
<error>, <datasource> elements and
relationship type="call" (procedure/function call edges
carry no column lineage). Aggregate flags use the same first-hop
detection as single mode (AGGREGATE_FUNCTION_NAMES +
isWindowFunctionResultset(org.w3c.dom.Element, org.w3c.dom.Document)); the slice-48 scalar-wrapper
descent is not applied in graph mode (PG/Snowflake-only shape,
out of mssql-corpus scope).
xml - dlineage XML output, must not be null/emptyvendor - source SQL dialect; recorded for API parity with
project(String, EDbVendor), not consulted