Skip to content

Commit

Permalink
hotfix: remove duplicate column name in lineage (#435)
Browse files Browse the repository at this point in the history
* hotfix: remove duplicate

* fix lint
  • Loading branch information
y-bruin authored Jan 31, 2025
1 parent bca092d commit 60e1545
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions pkg/pipeline/lineage.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,14 +239,18 @@ func (p *LineageExtractor) addColumnToAsset(asset *Asset, colName string, upstre
return errors.New("invalid arguments: all parameters must be non-nil and colName must not be empty")
}

if upstreamAsset == nil {
asset.Columns = append(asset.Columns, *upstreamCol)
return nil
}
if colName == "*" {
return nil
}

if upstreamAsset == nil {
existingCol := asset.GetColumnWithName(strings.ToLower(upstreamCol.Name))
if existingCol == nil {
asset.Columns = append(asset.Columns, *upstreamCol)
return nil
}
return nil
}
existingCol := asset.GetColumnWithName(colName)
if existingCol != nil {
if len(existingCol.Description) == 0 {
Expand All @@ -261,6 +265,7 @@ func (p *LineageExtractor) addColumnToAsset(asset *Asset, colName string, upstre
newUpstream := UpstreamColumn{
Column: upstreamCol.Name,
}

if upstreamAsset != nil {
newUpstream.Table = upstreamAsset.Name
}
Expand Down

0 comments on commit 60e1545

Please sign in to comment.