public final class SqllrSnapshot extends Object
docs/designs/data-lineage/09-sqllr-v2-runtime-driven-coverage-plan-zh.md, Section 3.1).
The snapshot holds values only: strings, numbers, flags and handles. It never holds a runtime model object, a
parse tree node, a token, a parser, a resolver namespace, a catalog, a Throwable or anything that reads a
ThreadLocal, so it stays readable after the analyzer is disposed and from any thread. Records refer to each
other by handle: every object of the analysis (statement, name reference, model node, relationship, parse text) gets
one handle, the first time the recorder sees it, and keeps it. Handle 0 means none.
Two kinds of values are kept apart. Events (SqllrSnapshot.ElementEvent, SqllrSnapshot.ReferenceEvent, SqllrSnapshot.Name,
SqllrSnapshot.Statement) are copied when they happen, before the analysis de-duplicates or rewrites anything:
a + a is two element events. The topology (SqllrSnapshot.Node, SqllrSnapshot.Relation, SqllrSnapshot.Contribution) is copied
once, when the analysis is complete and before output materialization changes the model: a + a is one
contribution, which lists both of its events.
Internal API of the SQL-LR producer.
| Modifier and Type | Class and Description |
|---|---|
static class |
SqllrSnapshot.Alternative
One alternative the resolver gave a name: where its column comes from, unflattened.
|
static class |
SqllrSnapshot.Anchor
Where a parse tree node lies: its class and its first and last tokens.
|
static class |
SqllrSnapshot.Call
A function or CASE the analysis built a result set for, described by its parse.
|
static class |
SqllrSnapshot.ColumnReference
A column reference of the parse, whether the analysis read it or not (a failed read leaves no event): its name
and its resolution at the freeze.
|
static class |
SqllrSnapshot.Contribution
One element of a frozen relationship (its target, or one de-duplicated source) with the events that gave it.
|
static class |
SqllrSnapshot.Decision
A binding the analysis decided by a fallback (plan 06, Section 3.3, decision points), recorded before it acts on
it: the reference as it stood, what was selected and why.
|
static class |
SqllrSnapshot.Declaration
A declared parameter or variable, used or not.
|
static class |
SqllrSnapshot.Derived
A statement of dynamic SQL text, with the statement whose analysis parsed it.
|
static class |
SqllrSnapshot.Element
A relationship element: the node it stands for and how the relationship reads it.
|
static class |
SqllrSnapshot.ElementEvent
An element added as a source of a relationship, or set as its target, copied when it happened.
|
static class |
SqllrSnapshot.Layout
The output layout of one query block: its items, also when there are none.
|
static class |
SqllrSnapshot.Name
A name reference the analysis read, copied when first seen.
|
static class |
SqllrSnapshot.Node
A node of the runtime model: a table, view, variable, result set, function, column, relation-rows pseudo column,
process or routine, as it stood at the freeze.
|
static class |
SqllrSnapshot.Position
A
Pair3<Long, Long, String> position of the model. |
static class |
SqllrSnapshot.ReferenceEvent
A name reference the analysis read for a target, whether or not it added a source.
|
static class |
SqllrSnapshot.RegistryEntry
The members of one model registry, in the registry's order (processes, packages, routines, tables, ...).
|
static class |
SqllrSnapshot.Relation
A relationship as it stood at the freeze.
|
static class |
SqllrSnapshot.Resolution
A name's resolution as it stood at one moment: status, every alternative and the table linked to it.
|
static class |
SqllrSnapshot.Statement
A statement the analysis worked in, copied when first seen.
|
static class |
SqllrSnapshot.StructField
A column built for a field of a STRUCT that a select item constructs.
|
static class |
SqllrSnapshot.SyntaxError
A syntax error of a parsed unit.
|
static class |
SqllrSnapshot.Text
One parse text (a token list): an input unit's, or one the analysis parsed from dynamic SQL.
|
static class |
SqllrSnapshot.Token
A source token as the parse left it when it was copied.
|
static class |
SqllrSnapshot.TransformValue
A transform the analysis attached to a relationship element.
|
static class |
SqllrSnapshot.Unit
One parsed input unit.
|
static class |
SqllrSnapshot.WriteRow
One row an INSERT writes from a VALUES list (or DEFAULT VALUES), item by item.
|
| Modifier and Type | Method and Description |
|---|---|
String |
canonical()
The snapshot written canonically: equal snapshots, and only equal ones, write the same text.
|
String |
digest()
The SHA-256 of
canonical(), in lower-case hex. |
List<SqllrSnapshot.ColumnReference> |
getColumnReferences()
Every column reference of the analysed statements' parse, read or not, in text order.
|
List<SqllrSnapshot.Decision> |
getDecisions()
Every fallback decision, in recording order.
|
List<SqllrSnapshot.Declaration> |
getDeclarations()
Every declared parameter and variable of the analysed statements, used or not, in text order.
|
List<SqllrSnapshot.Derived> |
getDerived() |
List<SqllrSnapshot.ElementEvent> |
getElementEvents()
Every element event, in recording order.
|
List<SqllrSnapshot.Layout> |
getLayouts()
The output layout of every query block of the analysed statements, in text order.
|
List<SqllrSnapshot.Name> |
getNames()
Every name reference an event carries, in handle order.
|
List<SqllrSnapshot.Node> |
getNodes()
Every model node: those the model registers for output (processes, routines, tables, views, result sets), then
any other node an element or member reaches, in handle order.
|
String |
getProjectionFailure()
Why copying the declarations, layouts, written rows and column references from the parse stopped (they are then
incomplete), or null.
|
List<SqllrSnapshot.ReferenceEvent> |
getReferenceEvents()
Every reference event, in recording order.
|
List<SqllrSnapshot.RegistryEntry> |
getRegistry()
The model's registries, each in its own order; a node may also be reached only through a relationship.
|
List<SqllrSnapshot.Relation> |
getRelations()
Every relationship at the freeze, in creation order.
|
List<SqllrSnapshot.Statement> |
getStatements()
Every statement the analysis worked in, in handle order.
|
List<SqllrSnapshot.StructField> |
getStructFields() |
List<SqllrSnapshot.Text> |
getTexts()
Every parse text a copied token belongs to, by handle.
|
List<SqllrSnapshot.Unit> |
getUnits()
The parsed units, in analysis order.
|
List<SqllrSnapshot.WriteRow> |
getWriteRows()
Every row an INSERT of the analysed statements writes from VALUES (or DEFAULT VALUES), in text order.
|
public List<SqllrSnapshot.Text> getTexts()
public List<SqllrSnapshot.Unit> getUnits()
public List<SqllrSnapshot.Statement> getStatements()
public List<SqllrSnapshot.Name> getNames()
public List<SqllrSnapshot.Node> getNodes()
public List<SqllrSnapshot.Relation> getRelations()
public List<SqllrSnapshot.ElementEvent> getElementEvents()
public List<SqllrSnapshot.ReferenceEvent> getReferenceEvents()
public List<SqllrSnapshot.Derived> getDerived()
public List<SqllrSnapshot.StructField> getStructFields()
public List<SqllrSnapshot.Decision> getDecisions()
public List<SqllrSnapshot.RegistryEntry> getRegistry()
public List<SqllrSnapshot.Declaration> getDeclarations()
public List<SqllrSnapshot.Layout> getLayouts()
public List<SqllrSnapshot.WriteRow> getWriteRows()
public List<SqllrSnapshot.ColumnReference> getColumnReferences()
public String getProjectionFailure()
public String canonical()
public String digest()
canonical(), in lower-case hex.