public class DlineageUtil extends Object
| Constructor and Description |
|---|
DlineageUtil() |
| Modifier and Type | Method and Description |
|---|---|
static Object |
analysisNameKey(String lexical,
ESQLDataObjectType objectType)
The identity key of a name AS WRITTEN IN SQL in the role
objectType (dotCatalog for the
database of CREATE DATABASE d CLONE src): a QualifiedCanonKey under the analysis's identifier
rules. |
static CanonKey |
catalogColumnKey(EDbVendor vendor,
String storedName)
Identity key of a column name as a catalog stores it; see
lexicalColumnKey(gudusoft.gsqlparser.EDbVendor, java.lang.String). |
static String |
catalogColumnLexical(EDbVendor vendor,
String storedName)
A stored column name spelled as SQL, under the same rules as
catalogColumnKey(gudusoft.gsqlparser.EDbVendor, java.lang.String). |
static CanonKey |
columnKey(TObjectName column)
Identity comes from the AST spelling, never a rendered model name.
|
static boolean |
columnMatches(Column model,
String reference)
columnMatches(Column, TObjectName) for a reference held as text, as written. |
static boolean |
columnMatches(Column model,
TObjectName reference)
Whether a column model is the column a reference names.
|
static String |
columnSegmentOf(String column)
The RAW column (last) segment of a reference —
getColumnName(String)'s
extraction (naive last-dot split, trim, whole-string fallback) WITHOUT the
normalization, for callers that canonically compare a segment against a
differently-shaped operand. |
static boolean |
compareColumnIdentifier(String source,
String target) |
static boolean |
compareIdentifier(String source,
String target,
ESQLDataObjectType sqlDataObjectType) |
static boolean |
compareTableIdentifier(String source,
String target) |
static boolean |
configuresIdentifierRules()
Whether the analysis runs under identifier rules of its own rather than its vendor's
defaults; only then do lineage name comparisons and keys follow the analysis's service.
|
static SqlInfo[] |
convertSQL(File file,
String json) |
static sourceColumn |
copySourceColumn(sourceColumn oldSourceName) |
static String |
decodeAliasIdentifier(String alias)
Decode a delimited identifier that sits in ALIAS position.
|
static String |
decodeColumnIdentifier(String name)
Decode a delimited COLUMN identifier to the name a catalog stores, keeping
the author's letter case:
[Volgorde], "Volgorde",
`Volgorde` and the SQL Server legacy alias form 'Volgorde'
all become Volgorde; escapes resolve ([Esc]]aped] →
Esc]aped). |
static CanonKey |
fieldLeafKey(TObjectName name)
The identity of the last segment of a field path (a struct or property access such as
a.left.Name),
the name lineage publishes for such a column. |
static String |
fieldLeafText(TObjectName name)
The last segment of a field path as written: the last of the parts beyond the six the parser names
(
a.b.c.d.e.f.Name), else the resolver's field path's last segment, else the property token, else the
column segment. |
static String |
getColumnName(String column)
Deprecated.
dlineage no longer calls it. For identity use the name service (
sameName(gudusoft.gsqlparser.sqlenv.ESQLDataObjectType, java.lang.String, java.lang.String),
sameColumnName(gudusoft.gsqlparser.nodes.TObjectName, gudusoft.gsqlparser.nodes.TObjectName), lexicalNameKey(gudusoft.gsqlparser.EDbVendor, java.lang.String, gudusoft.gsqlparser.sqlenv.ESQLDataObjectType)); for a published name of output version 1,
LegacyDlineageWireNamesV1.columnName(String) of columnSegmentOf(java.lang.String). |
static String |
getColumnName(TObjectName column)
Deprecated.
dlineage no longer calls it. For identity use the name service (
sameName(gudusoft.gsqlparser.sqlenv.ESQLDataObjectType, java.lang.String, java.lang.String),
sameColumnName(gudusoft.gsqlparser.nodes.TObjectName, gudusoft.gsqlparser.nodes.TObjectName), lexicalNameKey(gudusoft.gsqlparser.EDbVendor, java.lang.String, gudusoft.gsqlparser.sqlenv.ESQLDataObjectType)); for a published name of output version 1,
LegacyDlineageWireNamesV1.columnName(TObjectName). |
static String |
getColumnNameOnly(String columnName) |
static String |
getFunctionNameWithArgNum(TFunctionCall function) |
static String |
getIdentifierFunctionName(table function) |
static String |
getIdentifierNormalColumnName(String name)
Deprecated.
dlineage no longer calls it. For identity use the name service (
sameName(gudusoft.gsqlparser.sqlenv.ESQLDataObjectType, java.lang.String, java.lang.String),
sameColumnName(gudusoft.gsqlparser.nodes.TObjectName, gudusoft.gsqlparser.nodes.TObjectName), lexicalNameKey(gudusoft.gsqlparser.EDbVendor, java.lang.String, gudusoft.gsqlparser.sqlenv.ESQLDataObjectType)); for a published name of output version 1,
LegacyDlineageWireNamesV1.columnName(String). |
static String |
getIdentifierNormalColumnName(String name,
EDbVendor dbVendor)
Deprecated.
dlineage no longer calls it. For identity use the name service (
sameName(gudusoft.gsqlparser.sqlenv.ESQLDataObjectType, java.lang.String, java.lang.String),
sameColumnName(gudusoft.gsqlparser.nodes.TObjectName, gudusoft.gsqlparser.nodes.TObjectName), lexicalNameKey(gudusoft.gsqlparser.EDbVendor, java.lang.String, gudusoft.gsqlparser.sqlenv.ESQLDataObjectType)); for a published name of output version 1,
LegacyDlineageWireNamesV1.columnName(EDbVendor, String). |
static String |
getIdentifierNormalFunctionName(String name)
Deprecated.
dlineage no longer calls it. For identity use the name service (
sameName(gudusoft.gsqlparser.sqlenv.ESQLDataObjectType, java.lang.String, java.lang.String),
sameColumnName(gudusoft.gsqlparser.nodes.TObjectName, gudusoft.gsqlparser.nodes.TObjectName), lexicalNameKey(gudusoft.gsqlparser.EDbVendor, java.lang.String, gudusoft.gsqlparser.sqlenv.ESQLDataObjectType)); for a published name of output version 1,
LegacyDlineageWireNamesV1.functionName(String). |
static String |
getIdentifierNormalName(String name,
ESQLDataObjectType sqlDataObjectType)
Deprecated.
dlineage no longer calls it. For identity use the name service (
sameName(gudusoft.gsqlparser.sqlenv.ESQLDataObjectType, java.lang.String, java.lang.String),
sameColumnName(gudusoft.gsqlparser.nodes.TObjectName, gudusoft.gsqlparser.nodes.TObjectName), lexicalNameKey(gudusoft.gsqlparser.EDbVendor, java.lang.String, gudusoft.gsqlparser.sqlenv.ESQLDataObjectType)); for a published name of output version 1,
LegacyDlineageWireNamesV1.name(String, ESQLDataObjectType). |
static String |
getIdentifierNormalTableName(String name)
Deprecated.
dlineage no longer calls it. For identity use the name service (
sameName(gudusoft.gsqlparser.sqlenv.ESQLDataObjectType, java.lang.String, java.lang.String),
sameColumnName(gudusoft.gsqlparser.nodes.TObjectName, gudusoft.gsqlparser.nodes.TObjectName), lexicalNameKey(gudusoft.gsqlparser.EDbVendor, java.lang.String, gudusoft.gsqlparser.sqlenv.ESQLDataObjectType)); for a published name of output version 1,
LegacyDlineageWireNamesV1.tableName(String). |
static String |
getIdentifierOraclePackageNameWithArgNum(oraclePackage pkg) |
static String |
getIdentifierProcedureNameWithArgNum(procedure procedure) |
static TSelectSqlStatement |
getLeftStmt(TSelectSqlStatement stmt) |
static String |
getProcedureNameWithArgNum(TStoredProcedureSqlStatement stmt) |
static String |
getProcedureNameWithArgs(TStoredProcedureSqlStatement stmt) |
static String |
getProcedureNameWithInputArgNum(TStoredProcedureSqlStatement stmt) |
static TObjectName |
getProcedureOrFunctionName(TStoredProcedureSqlStatement stmt) |
static String |
getProcedureParentName(TCustomSqlStatement stmt) |
static Object |
getQualifiedTableIdentityKey(String qualifiedName)
Merge key of a physical table or view by the qualified name the output carries: the
analysis's identity where the name has one, else the legacy folded name.
|
static String |
getQualifiedTableName(table table) |
static String |
getSimpleTableName(String tableName) |
static String |
getTableDatabase(String tableName) |
static String |
getTableFullName(String tableName)
dlineage's display name of a table: qualified with the current default database and schema,
in the form output version 1 publishes (
LegacyDlineageWireNamesV1.tableBucket(java.lang.String)). |
static String |
getTableFullNameAsWritten(String tableName)
The same qualification as
getTableFullName(java.lang.String), with the name kept AS WRITTEN. |
static String |
getTableFullNameWithDefaultSchema(String tableName) |
static String |
getTableFullNameWithDefaultSchemaAsWritten(String tableName)
getTableFullNameWithDefaultSchema(java.lang.String) before the legacy fold: the default database and
schema added as text, the name itself left as written. |
static Object |
getTableIdentityKey(String lexicalName)
Internal table binding key.
|
static Object |
getTableIdentityKeyWithDefaultSchema(String lexicalName) |
static String |
getTableSchema(String tableName) |
static String |
getTableSchema(Table tableModel) |
static String |
getTableServer(String tableName) |
static String |
getTableSQLEnvKey(Table tableModel) |
static TCustomSqlStatement |
getTopBasicStmt(TCustomSqlStatement stmt) |
static TCustomSqlStatement |
getTopStmt(TCustomSqlStatement stmt) |
static boolean |
hasUsableCoordinate(String coordinate)
Whether a serialized coordinate ("[line,col,offset],[line,col,offset]...")
points at a real reference site.
|
static String |
identityScopeKey(String legacyScopeKey,
RoutineIdentity identity)
B1 (routine-summary-scc-design §3): overload-discriminating scope key.
|
static boolean |
isBuiltInFunctionName(String functionName) |
static boolean |
isFieldPath(TObjectName name)
Whether a name reaches below its column: a property token, or a STRUCT field the resolver found.
|
static boolean |
isKeyword(String objectName) |
static boolean |
isProcedureExcluded(String fullName) |
static boolean |
isQuote(String column) |
static boolean |
isStarEndpoint(Map<String,column> columnsById,
String id,
String name)
Whether a relationship endpoint stands for a star: by its published column when the document has one under
its id, else by the name the endpoint carries (an endpoint of a column the document does not list, such as a
star-link entry, is named after it).
|
static boolean |
isStarName(TObjectName name)
Whether a name stands for a star: the parse's wildcard (
*, t.*), or a star dlineage
synthesized (syntheticStarName()). |
static boolean |
isTempTable(Table tableModel,
EDbVendor vendor) |
static boolean |
isWildcard(TObjectName column) |
static CanonKey |
lexicalColumnKey(EDbVendor vendor,
String lexical)
Identity key of a column name as written in SQL: under the analysis's identifier rules
when it configures its own, else under the vendor default, as it always was.
|
static Object |
lexicalNameKey(EDbVendor vendor,
String lexical,
ESQLDataObjectType objectType)
Identity key of a name as written in SQL, qualified or not, under the same rules as
lexicalColumnKey(gudusoft.gsqlparser.EDbVendor, java.lang.String)
(the analysis's rules when it configures its own for this vendor, else the vendor's defaults): a QualifiedCanonKey of
objectType. |
static boolean |
modelsStructTree()
Deprecated.
read
NestedAccessProfile.buildsDeclaredTree() of the analysis's vendor |
static boolean |
modelsStructTree(EDbVendor vendor)
Deprecated.
read
NestedAccessProfile.forVendor(vendor).buildsDeclaredTree() |
static String |
normalizeColumnName(String name)
Deprecated.
dlineage no longer calls it. For identity use the name service (
sameName(gudusoft.gsqlparser.sqlenv.ESQLDataObjectType, java.lang.String, java.lang.String),
sameColumnName(gudusoft.gsqlparser.nodes.TObjectName, gudusoft.gsqlparser.nodes.TObjectName), lexicalNameKey(gudusoft.gsqlparser.EDbVendor, java.lang.String, gudusoft.gsqlparser.sqlenv.ESQLDataObjectType)); for a published name of output version 1,
LegacyDlineageWireNamesV1.columnSegment(String). |
static String |
normalizeColumnName(String name,
EDbVendor dbVendor)
Deprecated.
dlineage no longer calls it. For identity use the name service (
sameName(gudusoft.gsqlparser.sqlenv.ESQLDataObjectType, java.lang.String, java.lang.String),
sameColumnName(gudusoft.gsqlparser.nodes.TObjectName, gudusoft.gsqlparser.nodes.TObjectName), lexicalNameKey(gudusoft.gsqlparser.EDbVendor, java.lang.String, gudusoft.gsqlparser.sqlenv.ESQLDataObjectType)); for a published name of output version 1,
LegacyDlineageWireNamesV1.columnSegment(EDbVendor, String). |
static Map<String,column> |
outputColumnsById(dataflow document)
The published columns of a document by id, for
isStarEndpoint(java.util.Map<java.lang.String, gudusoft.gsqlparser.dlineage.dataflow.model.xml.column>, java.lang.String, java.lang.String). |
static String |
physicalTableMergeKey(Map<String,List<Object>> identitiesByLegacyName,
String legacyKey,
String qualifiedTableName)
The merge key of a physical table or view in an output dataflow: its legacy folded name,
unless another table already holds that name with a different identity under the
analysis's rules, in which case it gets a key of its own.
|
static String |
propertyColumnPath(TObjectName name)
The name of an attribute of a column,
column.attribute, each segment decoded as a column name is:
how a TableColumn for tgt.objcol.attr is named outside the STRUCT-path vendors, and how an
UPDATE or MERGE action names the column it writes into such an attribute. |
static TSourceToken |
propertyLeafToken(TObjectName name)
The last field of a name that has a property token: the property itself, or, when the property is the first
of several fields, the last of them.
|
static QualifiedCanonKey |
publishedTableIdentity(String qualifiedTableName,
String legacyKey)
The identity a published table name reads as, under the analysis's identifier rules: the name
taken as a SQL spelling.
|
static void |
publishStarProvenance(column element,
Column model)
Carries a model column's star provenance onto its published column: a column NAMED
* that is not a
star is marked star="false", so the output, in memory and read back from XML, tells it from a star
(column.standsForStar()). |
static String |
rawColumnName(TObjectName column)
The column (last) segment of an AST name as written:
getColumnName(TObjectName) without the normalization. |
static boolean |
sameColumnDisplay(String modelName,
String otherName)
sameColumnDisplay(String, TObjectName) of two model names, each cut at its last dot. |
static boolean |
sameColumnDisplay(String modelName,
TObjectName name)
Whether a model column's name and a reference name DISPLAY alike: their column segments in the form output
version 1 publishes (
LegacyDlineageWireNamesV1.columnName(java.lang.String)), compared as the vendor compares names. |
static boolean |
sameColumnName(String a,
String b)
Both operands model name strings: see
sameColumnSegment(java.lang.String, java.lang.String). |
static boolean |
sameColumnName(String a,
TObjectName b)
Mixed operand shapes: model name string vs AST object name.
|
static boolean |
sameColumnName(TObjectName a,
String b)
Mixed operand shapes: AST object name vs model name string.
|
static boolean |
sameColumnName(TObjectName a,
TObjectName b)
Canonical counterpart of comparing
getColumnName(TObjectName) results. |
static boolean |
sameColumnNormalName(String a,
String b)
Whether two column NORMAL names (results of
getIdentifierNormalColumnName(java.lang.String)) name the
same column. |
static boolean |
sameColumnPath(EDbVendor vendor,
String a,
String b)
sameColumnPath(String, String) for a vendor given explicitly, under its default rules. |
static boolean |
sameColumnPath(String a,
String b)
Whether two column paths name the same column: the same number of segments, each segment the
same COLUMN name.
|
static boolean |
sameColumnSegment(String a,
String b)
Canonical equality of the column (last) segments of two references — the
canonical counterpart of comparing
getColumnName(String) results:
same naive last-dot split, same trim and empty-segment fallback, but the raw
segments go to the canonical engine instead of normalize-then-equalsIgnoreCase. |
static boolean |
sameFieldLeaf(TObjectName a,
TObjectName b)
Whether two references name the same field below their column: neither is a field path, or both are and
their leaves are the same name.
|
static boolean |
sameName(ESQLDataObjectType objectType,
String a,
String b)
Single-segment identifier equality via the unified façade, using the bound
global analysis vendor; falls back to case-insensitive comparison when no
vendor is bound (model classes used outside an analysis run).
|
static boolean |
sameQualifiedName(ESQLDataObjectType objectType,
String a,
String b)
Like
sameName(gudusoft.gsqlparser.sqlenv.ESQLDataObjectType, java.lang.String, java.lang.String) but for possibly-qualified names; routes through the
segmenting SQLUtil#compareIdentifier. |
static Object |
schemaNameKey(String lexical)
The identity key of a schema name AS WRITTEN IN SQL (
CREATE SCHEMA s CLONE db.src): a
QualifiedCanonKey of dotSchema under the analysis's identifier rules, its segments the
catalog and the schema. |
static String |
storedNameSpelling(ESQLDataObjectType role,
String name)
The SQL spelling of a stored database or schema name: the bare name when the bare word, read as
SQL, is that stored name (PostgreSQL
public), else its delimited spelling (a schema stored
as Mixed is "Mixed"). |
static String |
stripQuotesFromQualifiedName(String qualifiedName) |
static boolean |
supportFunctionOverride(EDbVendor vendor) |
static TObjectName |
syntheticStarName()
A
* dlineage synthesizes for a whole-table pseudo column (a clone, a rename, a synonym, a COPY target
without columns). |
static Object |
tableNameKey(String lexical)
The identity key of a table name, or of a table alias, AS WRITTEN IN SQL: a
QualifiedCanonKey under the analysis's identifier rules (its configured profile, else its
vendor's defaults), with an omitted SQL Server schema filled in as withSessionSchema(java.lang.String)
does. |
static String |
withSessionSchema(EDbVendor vendor,
String qualifiedName)
withSessionSchema(String) for a vendor given explicitly. |
static String |
withSessionSchema(String qualifiedName)
A SQL Server name may omit its schema (
db..t); the omission means the session's
default schema, a fact about the analysis rather than about the name. |
public DlineageUtil()
public static boolean hasUsableCoordinate(String coordinate)
public static boolean compareIdentifier(String source, String target, ESQLDataObjectType sqlDataObjectType)
public static boolean compareColumnIdentifier(String source, String target)
public static boolean compareTableIdentifier(String source, String target)
public static boolean configuresIdentifierRules()
public static boolean sameName(ESQLDataObjectType objectType, String a, String b)
public static boolean sameQualifiedName(ESQLDataObjectType objectType, String a, String b)
sameName(gudusoft.gsqlparser.sqlenv.ESQLDataObjectType, java.lang.String, java.lang.String) but for possibly-qualified names; routes through the
segmenting SQLUtil#compareIdentifier.public static Object tableNameKey(String lexical)
QualifiedCanonKey under the analysis's identifier rules (its configured profile, else its
vendor's defaults), with an omitted SQL Server schema filled in as withSessionSchema(java.lang.String)
does. Text that is not a qualified identifier (a database link written into the name, a
function-call shape) is keyed exactly, as a label, so it never merges with another spelling.
Only for text the SQL spelled. A model's display name has lost its quote state and must not be keyed here.
public static Object schemaNameKey(String lexical)
CREATE SCHEMA s CLONE db.src): a
QualifiedCanonKey of dotSchema under the analysis's identifier rules, its segments the
catalog and the schema. Text the rules cannot read as a name is keyed exactly, as a label, so it never
merges with another spelling.public static Object analysisNameKey(String lexical, ESQLDataObjectType objectType)
objectType (dotCatalog for the
database of CREATE DATABASE d CLONE src): a QualifiedCanonKey under the analysis's identifier
rules. Text the rules cannot read as a name is keyed exactly, as a label, so it never merges with another
spelling.public static String withSessionSchema(String qualifiedName)
db..t); the omission means the session's
default schema, a fact about the analysis rather than about the name. Every interior empty
segment is filled with it: the schema the analysis is in, else dbo. This is the
qualification lineage has always applied before comparing such names. Segments are split by
SQLUtil#parseNames, so a delimited segment such as [a..b] is never looked into.public static String withSessionSchema(EDbVendor vendor, String qualifiedName)
withSessionSchema(String) for a vendor given explicitly.public static boolean sameColumnSegment(String a, String b)
getColumnName(String) results:
same naive last-dot split, same trim and empty-segment fallback, but the raw
segments go to the canonical engine instead of normalize-then-equalsIgnoreCase.public static boolean sameColumnNormalName(String a, String b)
getIdentifierNormalColumnName(java.lang.String)) name the
same column. Lineage has always matched normal names case-insensitively; this keeps that and
only narrows it, so two names that differ just in case match only when the identifier rules
say they are one name. ClickHouse userId and userid, which
NormalNameCollisions gives normal names of their own, stay apart.public static boolean sameColumnDisplay(String modelName, TObjectName name)
LegacyDlineageWireNamesV1.columnName(java.lang.String)), compared as the vendor compares names. This
is a comparison of displays, not of identities, for the places that compare names where identity cannot decide:
star links grouped by display (-Dgsp.dlineage.starLinks=legacy), a label involved, a model name that
carries no identity. A model name is display text (Column.getName()),
so reading it as a SQL spelling would compare the wrong thing.public static boolean sameColumnDisplay(String modelName, String otherName)
sameColumnDisplay(String, TObjectName) of two model names, each cut at its last dot.public static boolean sameColumnName(TObjectName a, TObjectName b)
getColumnName(TObjectName) results.public static boolean sameColumnName(String a, TObjectName b)
public static boolean sameColumnName(TObjectName a, String b)
public static boolean sameColumnName(String a, String b)
sameColumnSegment(java.lang.String, java.lang.String).public static boolean sameColumnPath(String a, String b)
customer.name), so no segment is a table or schema qualifier and
none follows the rules of one: on BigQuery tables are case-sensitive while columns and fields
are not. For a reference that may carry a table qualifier use sameQualifiedName(gudusoft.gsqlparser.sqlenv.ESQLDataObjectType, java.lang.String, java.lang.String).public static boolean sameColumnPath(EDbVendor vendor, String a, String b)
sameColumnPath(String, String) for a vendor given explicitly, under its default rules.public static boolean columnMatches(Column model, TObjectName reference)
public static boolean columnMatches(Column model, String reference)
columnMatches(Column, TObjectName) for a reference held as text, as written.public static String columnSegmentOf(String column)
getColumnName(String)'s
extraction (naive last-dot split, trim, whole-string fallback) WITHOUT the
normalization, for callers that canonically compare a segment against a
differently-shaped operand.public static String rawColumnName(TObjectName column)
getColumnName(TObjectName) without the normalization.public static CanonKey columnKey(TObjectName column)
public static CanonKey lexicalColumnKey(EDbVendor vendor, String lexical)
catalogColumnKey(gudusoft.gsqlparser.EDbVendor, java.lang.String), because a
key minted under one profile never equals a key minted under another.public static Object lexicalNameKey(EDbVendor vendor, String lexical, ESQLDataObjectType objectType)
lexicalColumnKey(gudusoft.gsqlparser.EDbVendor, java.lang.String)
(the analysis's rules when it configures its own for this vendor, else the vendor's defaults): a QualifiedCanonKey of
objectType. Text the rules cannot read as a name is keyed exactly, as a label, so it never merges with
another spelling. For readers whose input names are SQL spellings.public static CanonKey catalogColumnKey(EDbVendor vendor, String storedName)
lexicalColumnKey(gudusoft.gsqlparser.EDbVendor, java.lang.String).public static String catalogColumnLexical(EDbVendor vendor, String storedName)
catalogColumnKey(gudusoft.gsqlparser.EDbVendor, java.lang.String).public static TObjectName syntheticStarName()
* dlineage synthesizes for a whole-table pseudo column (a clone, a rename, a synonym, a COPY target
without columns). It has no part token, so the parse's own wildcard test (isWildcard(gudusoft.gsqlparser.nodes.TObjectName)) does not take it
for a SQL wildcard; isStarName(gudusoft.gsqlparser.nodes.TObjectName) knows it by its class.public static boolean isStarName(TObjectName name)
*, t.*), or a star dlineage
synthesized (syntheticStarName()). Decided by the parse and by provenance, never by the text: a
delimited column named *, and a name built from the text *, are not stars.public static CanonKey fieldLeafKey(TObjectName name)
a.left.Name),
the name lineage publishes for such a column. columnKey(gudusoft.gsqlparser.nodes.TObjectName) gives a field path no identity of its own;
this is the leaf's, under the analysis's rules, for questions about the published leaf name. Null for a name
that is not a field path.@Deprecated public static boolean modelsStructTree(EDbVendor vendor)
NestedAccessProfile.forVendor(vendor).buildsDeclaredTree()TObjectName.getFieldPathRead() answers. See
gsp_java_core/doc/refactor/bigquery_nested_column_lineage_plan.md.@Deprecated public static boolean modelsStructTree()
NestedAccessProfile.buildsDeclaredTree() of the analysis's vendormodelsStructTree(EDbVendor) for the vendor of the analysis.public static boolean isFieldPath(TObjectName name)
public static boolean sameFieldLeaf(TObjectName a, TObjectName b)
sameColumnName(TObjectName, TObjectName) compares the column segment
only, so tgt.objcol.a1 and tgt.objcol.a2 are one column there. A lookup for the exact column
a write lands in must check this as well, or the second attribute is written into the first (Mantis #4747).public static String propertyColumnPath(TObjectName name)
column.attribute, each segment decoded as a column name is:
how a TableColumn for tgt.objcol.attr is named outside the STRUCT-path vendors, and how an
UPDATE or MERGE action names the column it writes into such an attribute. Null when the name has no property
token.public static String fieldLeafText(TObjectName name)
a.b.c.d.e.f.Name), else the resolver's field path's last segment, else the property token, else the
column segment. The one extractor for a field path's published leaf and for its identity.public static TSourceToken propertyLeafToken(TObjectName name)
payload.address.city is read as column payload
with property address, and ends in the field city (Mantis 4822); the parse's identifier chain
(TObjectName.getIdentifierChain()) has them all. Null for a name with no property token.public static void publishStarProvenance(column element, Column model)
* that is not a
star is marked star="false", so the output, in memory and read back from XML, tells it from a star
(column.standsForStar()).public static boolean isStarEndpoint(Map<String,column> columnsById, String id, String name)
public static Map<String,column> outputColumnsById(dataflow document)
isStarEndpoint(java.util.Map<java.lang.String, gudusoft.gsqlparser.dlineage.dataflow.model.xml.column>, java.lang.String, java.lang.String).public static boolean isWildcard(TObjectName column)
public static String decodeColumnIdentifier(String name)
[Volgorde], "Volgorde",
`Volgorde` and the SQL Server legacy alias form 'Volgorde'
all become Volgorde; escapes resolve ([Esc]]aped] →
Esc]aped). Vendor- and role-aware, so a spelling that is not a
delimiter for the analysis vendor is left alone.
Used for the column names dlineage PUBLISHES, so that view columns and
relationship endpoints carry the same identifier a consumer finds in
sys.columns instead of a syntactic spelling it has to strip
itself (GitHub issue #704). Unrecognized or malformed input is returned
unchanged.
Only call this on a string of identifier provenance — a
TObjectName column token or a TAliasClause alias name.
A string CONSTANT reaches the model as quoted text too
('literal value' becomes a result-set column name), and decoding
one would corrupt the value it carries.
Nothing is decoded on a vendor whose delimiters carry identity.
Quoting is not always cosmetic: where a vendor case-folds UNQUOTED names,
the delimiters are what mark a name as case-exact, so Oracle
"Purchase Frequency" and Purchase Frequency (which folds
to PURCHASE FREQUENCY) are two DIFFERENT columns, and decoding
would rename the column rather than clean up its spelling. Such a vendor
is skipped ENTIRELY, by delimitersAreCosmetic(gudusoft.gsqlparser.EDbVendor), rather than
name-by-name: "DESCRIPTION" happens to fold to itself and could be
decoded safely, but decoding it while "Mixed Case" keeps its
quotes would publish two spelling conventions in one Oracle document and
leave consumers no single rule to apply. SQL Server — where [x],
"x", 'x' and x are all one case-insensitive column
— is cosmetic throughout, which is why issue #704 is a SQL Server issue.
A name whose payload contains a dot keeps its delimiters, even
on a vendor that passes the test above. Model names double as keys in the
dot-delimited qualified-name domain that SQLUtil#parseNames
segments, where the delimiters are what stop "name.dot" from
reading as name qualified by dot (the invariant
SQLUtil#quoteDottedName exists to keep). Publishing the decoded
form there cost a real CTAS lineage edge in the Snowflake corpus — a
downstream re-split renamed the target column to dot and dropped
its dependency.
In both held-back cases the name is returned exactly as written, so a consumer still has to decode it; that is strictly better than dropping an edge or renaming a column to improve a spelling.
SQLUtil#decodeDelimitedNamepublic static String decodeAliasIdentifier(String alias)
Same policy as decodeColumnIdentifier(java.lang.String), plus the vendor-blind
apostrophe form: several vendors accept a string literal as a column
alias (SELECT c AS 'myTime' is legal MySQL), and in alias position
there is no ambiguity with a value literal to protect against — a
TAliasClause has already proved this token names a column. The
column-reference codec cannot make that call, because for MySQL an
apostrophe delimits a STRING, not an identifier.
The apostrophe branch also preserves what
SQLUtil.trimSingleQuote did here before issue #704: without it,
routing aliases through the column codec would REGRESS MySQL
AS 'myTime' from myTime back to 'myTime'.
The publishable(gudusoft.gsqlparser.EDbVendor, java.lang.String) guards still apply, so this path can only ever
publish a name that survives a downstream re-decode.
@Deprecated public static String getIdentifierNormalColumnName(String name)
sameName(gudusoft.gsqlparser.sqlenv.ESQLDataObjectType, java.lang.String, java.lang.String),
sameColumnName(gudusoft.gsqlparser.nodes.TObjectName, gudusoft.gsqlparser.nodes.TObjectName), lexicalNameKey(gudusoft.gsqlparser.EDbVendor, java.lang.String, gudusoft.gsqlparser.sqlenv.ESQLDataObjectType)); for a published name of output version 1,
LegacyDlineageWireNamesV1.columnName(String).sameName(gudusoft.gsqlparser.sqlenv.ESQLDataObjectType, java.lang.String, java.lang.String), sameColumnSegment(java.lang.String, java.lang.String) or sameColumnName(gudusoft.gsqlparser.nodes.TObjectName, gudusoft.gsqlparser.nodes.TObjectName) —
comparing normal names with equals/equalsIgnoreCase is the pre-P0d
bug pattern. Model display-name bookkeeping is the one documented exception (see
the identifier normalization guide §6).@Deprecated public static String getIdentifierNormalColumnName(String name, EDbVendor dbVendor)
sameName(gudusoft.gsqlparser.sqlenv.ESQLDataObjectType, java.lang.String, java.lang.String),
sameColumnName(gudusoft.gsqlparser.nodes.TObjectName, gudusoft.gsqlparser.nodes.TObjectName), lexicalNameKey(gudusoft.gsqlparser.EDbVendor, java.lang.String, gudusoft.gsqlparser.sqlenv.ESQLDataObjectType)); for a published name of output version 1,
LegacyDlineageWireNamesV1.columnName(EDbVendor, String).sameName(gudusoft.gsqlparser.sqlenv.ESQLDataObjectType, java.lang.String, java.lang.String) /
sameColumnSegment(java.lang.String, java.lang.String) / sameColumnName(gudusoft.gsqlparser.nodes.TObjectName, gudusoft.gsqlparser.nodes.TObjectName), not string compares on
this result.@Deprecated public static String normalizeColumnName(String name)
sameName(gudusoft.gsqlparser.sqlenv.ESQLDataObjectType, java.lang.String, java.lang.String),
sameColumnName(gudusoft.gsqlparser.nodes.TObjectName, gudusoft.gsqlparser.nodes.TObjectName), lexicalNameKey(gudusoft.gsqlparser.EDbVendor, java.lang.String, gudusoft.gsqlparser.sqlenv.ESQLDataObjectType)); for a published name of output version 1,
LegacyDlineageWireNamesV1.columnSegment(String).sameName(gudusoft.gsqlparser.sqlenv.ESQLDataObjectType, java.lang.String, java.lang.String) / sameColumnSegment(java.lang.String, java.lang.String), not string compares on this result.@Deprecated public static String normalizeColumnName(String name, EDbVendor dbVendor)
sameName(gudusoft.gsqlparser.sqlenv.ESQLDataObjectType, java.lang.String, java.lang.String),
sameColumnName(gudusoft.gsqlparser.nodes.TObjectName, gudusoft.gsqlparser.nodes.TObjectName), lexicalNameKey(gudusoft.gsqlparser.EDbVendor, java.lang.String, gudusoft.gsqlparser.sqlenv.ESQLDataObjectType)); for a published name of output version 1,
LegacyDlineageWireNamesV1.columnSegment(EDbVendor, String).sameName(gudusoft.gsqlparser.sqlenv.ESQLDataObjectType, java.lang.String, java.lang.String) /
sameColumnSegment(java.lang.String, java.lang.String), not string compares on this result.@Deprecated public static String getIdentifierNormalTableName(String name)
sameName(gudusoft.gsqlparser.sqlenv.ESQLDataObjectType, java.lang.String, java.lang.String),
sameColumnName(gudusoft.gsqlparser.nodes.TObjectName, gudusoft.gsqlparser.nodes.TObjectName), lexicalNameKey(gudusoft.gsqlparser.EDbVendor, java.lang.String, gudusoft.gsqlparser.sqlenv.ESQLDataObjectType)); for a published name of output version 1,
LegacyDlineageWireNamesV1.tableName(String).sameName(gudusoft.gsqlparser.sqlenv.ESQLDataObjectType, java.lang.String, java.lang.String) / sameQualifiedName(gudusoft.gsqlparser.sqlenv.ESQLDataObjectType, java.lang.String, java.lang.String) /
compareTableIdentifier(java.lang.String, java.lang.String).@Deprecated public static String getIdentifierNormalFunctionName(String name)
sameName(gudusoft.gsqlparser.sqlenv.ESQLDataObjectType, java.lang.String, java.lang.String),
sameColumnName(gudusoft.gsqlparser.nodes.TObjectName, gudusoft.gsqlparser.nodes.TObjectName), lexicalNameKey(gudusoft.gsqlparser.EDbVendor, java.lang.String, gudusoft.gsqlparser.sqlenv.ESQLDataObjectType)); for a published name of output version 1,
LegacyDlineageWireNamesV1.functionName(String).sameName(gudusoft.gsqlparser.sqlenv.ESQLDataObjectType, java.lang.String, java.lang.String) with dotFunction, not string compares on this result.@Deprecated public static String getIdentifierNormalName(String name, ESQLDataObjectType sqlDataObjectType)
sameName(gudusoft.gsqlparser.sqlenv.ESQLDataObjectType, java.lang.String, java.lang.String),
sameColumnName(gudusoft.gsqlparser.nodes.TObjectName, gudusoft.gsqlparser.nodes.TObjectName), lexicalNameKey(gudusoft.gsqlparser.EDbVendor, java.lang.String, gudusoft.gsqlparser.sqlenv.ESQLDataObjectType)); for a published name of output version 1,
LegacyDlineageWireNamesV1.name(String, ESQLDataObjectType).sameName(gudusoft.gsqlparser.sqlenv.ESQLDataObjectType, java.lang.String, java.lang.String) / sameQualifiedName(gudusoft.gsqlparser.sqlenv.ESQLDataObjectType, java.lang.String, java.lang.String), not string compares on this result.@Deprecated public static String getColumnName(TObjectName column)
sameName(gudusoft.gsqlparser.sqlenv.ESQLDataObjectType, java.lang.String, java.lang.String),
sameColumnName(gudusoft.gsqlparser.nodes.TObjectName, gudusoft.gsqlparser.nodes.TObjectName), lexicalNameKey(gudusoft.gsqlparser.EDbVendor, java.lang.String, gudusoft.gsqlparser.sqlenv.ESQLDataObjectType)); for a published name of output version 1,
LegacyDlineageWireNamesV1.columnName(TObjectName).sameColumnName(TObjectName, TObjectName) — it feeds the
RAW segment to the canonical engine instead of comparing normalized display text.@Deprecated public static String getColumnName(String column)
sameName(gudusoft.gsqlparser.sqlenv.ESQLDataObjectType, java.lang.String, java.lang.String),
sameColumnName(gudusoft.gsqlparser.nodes.TObjectName, gudusoft.gsqlparser.nodes.TObjectName), lexicalNameKey(gudusoft.gsqlparser.EDbVendor, java.lang.String, gudusoft.gsqlparser.sqlenv.ESQLDataObjectType)); for a published name of output version 1,
LegacyDlineageWireNamesV1.columnName(String) of columnSegmentOf(java.lang.String).sameColumnSegment(String, String) —
it feeds the RAW segment to the canonical engine instead of comparing normalized
display text.public static boolean isTempTable(Table tableModel, EDbVendor vendor)
public static String getTableFullName(String tableName)
LegacyDlineageWireNamesV1.tableBucket(java.lang.String)). Besides
the display, it is only the compatibility bucket of a table that carries no identity. Not an
identity, and not a name to look a table up with: see getTableIdentityKey(java.lang.String) and
getTableFullNameAsWritten(java.lang.String).public static Object getTableIdentityKey(String lexicalName)
getTableFullNameAsWritten(java.lang.String) adds) and keys
that with the analysis's identifier rules instead of the vendor-default fold, so two tables
a configured profile keeps apart are not merged into one lineage model.public static Object getTableIdentityKeyWithDefaultSchema(String lexicalName)
public static Object getQualifiedTableIdentityKey(String qualifiedName)
public static String physicalTableMergeKey(Map<String,List<Object>> identitiesByLegacyName, String legacyKey, String qualifiedTableName)
identitiesByLegacyName - state shared by every table of one mergepublic static QualifiedCanonKey publishedTableIdentity(String qualifiedTableName, String legacyKey)
PhysicalTableMergeKeys uses it only where no carried identity decides.public static String storedNameSpelling(ESQLDataObjectType role, String name)
public), else its delimited spelling (a schema stored
as Mixed is "Mixed"). A name already delimited is returned as it is.public static String getTableFullNameAsWritten(String tableName)
getTableFullName(java.lang.String), with the name kept AS WRITTEN. Quote
state is part of a name's identity (Oracle "Orders" is not Orders, which
means ORDERS), so this is the form to ask the catalog with.public static String getSimpleTableName(String tableName)
public static String getColumnNameOnly(String columnName)
public static String getTableSchema(String tableName)
public static String getTableServer(String tableName)
public static String getTableDatabase(String tableName)
public static String getTableFullNameWithDefaultSchema(String tableName)
public static String getTableFullNameWithDefaultSchemaAsWritten(String tableName)
getTableFullNameWithDefaultSchema(java.lang.String) before the legacy fold: the default database and
schema added as text, the name itself left as written.public static SqlInfo[] convertSQL(File file, String json)
public static String getQualifiedTableName(table table)
public static TCustomSqlStatement getTopStmt(TCustomSqlStatement stmt)
public static TCustomSqlStatement getTopBasicStmt(TCustomSqlStatement stmt)
public static TObjectName getProcedureOrFunctionName(TStoredProcedureSqlStatement stmt)
public static String getProcedureNameWithArgs(TStoredProcedureSqlStatement stmt)
public static String getIdentifierProcedureNameWithArgNum(procedure procedure)
public static String getIdentifierOraclePackageNameWithArgNum(oraclePackage pkg)
public static String getIdentifierFunctionName(table function)
public static String getProcedureNameWithArgNum(TStoredProcedureSqlStatement stmt)
public static String getProcedureNameWithInputArgNum(TStoredProcedureSqlStatement stmt)
public static String getFunctionNameWithArgNum(TFunctionCall function)
public static String getTableSchema(Table tableModel)
public static String getTableSQLEnvKey(Table tableModel)
public static String identityScopeKey(String legacyScopeKey, RoutineIdentity identity)
public static String getProcedureParentName(TCustomSqlStatement stmt)
public static sourceColumn copySourceColumn(sourceColumn oldSourceName)
public static boolean supportFunctionOverride(EDbVendor vendor)
public static boolean isBuiltInFunctionName(String functionName)
public static TSelectSqlStatement getLeftStmt(TSelectSqlStatement stmt)
public static String stripQuotesFromQualifiedName(String qualifiedName)
public static boolean isProcedureExcluded(String fullName)