use of com.dtstack.taier.develop.sql.Pair in project Taier by DTStack.
the class AstNodeParser method getTableLineages.
/**
* 对表级血缘进行组装
*
* @param sqlNode
* @param lineageParser
* @return
*/
private List<TableLineage> getTableLineages(com.dtstack.taier.develop.sql.node.Node sqlNode, LineageParser lineageParser) {
List<TableLineage> resList = Lists.newArrayList();
List<Pair<Identifier, Identifier>> pairs = lineageParser.parseTableLineage(sqlNode);
if (CollectionUtils.isNotEmpty(pairs)) {
for (Pair<Identifier, Identifier> pair : pairs) {
Identifier key = pair.getKey();
Identifier value = pair.getValue();
TableLineage tableLineage = new TableLineage();
tableLineage.setFromDb(value.getDb());
tableLineage.setFromTable(value.getTable());
tableLineage.setToDb(key.getDb());
tableLineage.setToTable(key.getTable());
resList.add(tableLineage);
}
}
return resList;
}
use of com.dtstack.taier.develop.sql.Pair in project Taier by DTStack.
the class AstNodeParser method getColumnLineages.
private List<ColumnLineage> getColumnLineages(com.dtstack.taier.develop.sql.node.Node sqlNode, LineageParser lineageParser) {
List<ColumnLineage> resList = Lists.newArrayList();
List<Pair<Identifier, Identifier>> pairs = lineageParser.parseColumnLineage(sqlNode);
if (CollectionUtils.isNotEmpty(pairs)) {
for (Pair<Identifier, Identifier> pair : pairs) {
Identifier key = pair.getKey();
Identifier value = pair.getValue();
ColumnLineage columnLineage = new ColumnLineage();
columnLineage.setFromDb(value.getDb().replace("`", ""));
columnLineage.setFromTable(value.getTable().replace("`", ""));
columnLineage.setFromColumn(value.getColumn().replace("`", ""));
columnLineage.setToDb(key.getDb().replace("`", ""));
columnLineage.setToTable(key.getTable().replace("`", ""));
columnLineage.setToColumn(key.getColumn().replace("`", ""));
resList.add(columnLineage);
}
}
return resList;
}
Aggregations