You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- OpenLineage defines a [column-level lineage facet]- (https://github.com/OpenLineage/OpenLineage/blob/ff0d87d30ed6c9fe39472788948266a6d3190585/spec/facets/ColumnLineageDatasetFacet.md).
19
19
- Marquez has a lineage endpoint `GET /api/v1/lineage` that returns the current lineage graph connected to a job or a dataset
20
20
21
+
### Column lineage characteristics and general assumptions
22
+
23
+
Column level lineage is a different lineage graph due to a different node granularity - kind of zoomed-in view of existing lineage. Instead of datasets and jobs being lineage graph nodes, each dataset field becomes a node. Additionally, there are edges between dataset fields, instead of datasets itself. Thus, enriching existing lineage with column lineage information would not be sufficient. That’s why we propose another API endpoint with column lineage graph.
24
+
25
+
Upstream and downstream edges do have different characteristics. An output dataset is always produced by a single version of input dataset (one upstream), while a single input datset version can have multiple output dataset versions. Lineage graph can be then easily flooded by downstream subgraph which blurs the overall view. That's why we consider an upstream column lineage as a default one. Downstream lineage will be returned only when requested explicitly.
26
+
21
27
### New Elements
28
+
22
29
We propose to add the following:
23
-
- Add column lineage to the lineage endpoint
24
-
- A new column-lineage endpoint leveraging the column lineage facet to retrieve lineage for a given column.
25
-
- Point-in-time upstream (dataset or column level) lineage given a version of a dataset.
30
+
31
+
- Add column lineage to the lineage endpoint as a part of dataset.
32
+
- A new column-lineage endpoint leveraging the column lineage facet to retrieve lineage for a given column.
33
+
- Point-in-time upstream (dataset or column level) lineage given a version of a dataset.
26
34
27
35
## Proposal
28
36
29
-
### add column lineage to existing endpoint
30
-
In the GET /lineage api, add column lineage to DATASET nodes' data
37
+
### Add column lineage to existing endpoint
38
+
In the `GET /lineage` api, add column lineage to `DATASET` nodes' data:
31
39
```diff
32
40
{
33
41
"id": "dataset:food_delivery:public.categories",
@@ -66,78 +74,116 @@ In the GET /lineage api, add column lineage to DATASET nodes' data
66
74
}
67
75
```
68
76
69
-
### add a column-level-lineage endpoint:
77
+
The implementation here can reuse `columnLineage` facet classes.
78
+
79
+
80
+
### Add a column-level-lineage endpoint:
70
81
82
+
New endpoints to retrieve a column lineage of a single field or a whole dataset will be added:
71
83
```
72
-
GET /column-lineage?nodeId=dataset:food_delivery:public.delivery_7_days&column=a
84
+
GET /column-lineage?nodeId=dataset:{namespace}:{dataset}
85
+
GET /column-lineage?nodeId=datasetField:{namespace}:{dataset}:{field}
86
+
```
87
+
For example:
88
+
```
89
+
GET /column-lineage?nodeId=dataset:food_delivery:public.delivery_7_days
90
+
GET /column-lineage?nodeId=datasetField:food_delivery:public.delivery_7_days:a
73
91
```
74
-
`column` is a ne parameter that must be a column in the schema of the provided dataset `nodeId`.
75
92
76
-
The logic is layered on the existing lineage endpoint, filtering down to the datasets that contribute to that column.
77
-
It only returns dataset nodes.
93
+
Although creating a new endpoint, we would like to reuse existing data structures with a new `NodeType.FIELD` introduced.
78
94
79
-
```diff
95
+
The logic returns dataset field node:
96
+
97
+
```
98
+
GET /column-lineage?nodeId=datasetField:db1:table1:a
# Input fields, present within "inEdges", can be also returned within a graph due to a `depth` parameter greate than 0.
100
134
}
101
135
]
102
136
}
103
137
```
104
138
139
+
The `depth` parameter controls how many edges, from a given dataset field, shall be returned. The default is set to `0`. In case of default equal `1`, each `inputField` will be returned as a separate node within a response graph with `inputFields` used to produce it. Please note that extending depth may increase the graph size and affect request performance.
140
+
141
+
The endpoints above fetches upstream column-lineage for given dataset field or all fields within a dataset. Downstream column lineage is turned off by default. However, this can be turned on with an extra `withDownstream` parameter like:
142
+
143
+
```
144
+
GET /column-lineage?nodeId=datasetField:food_delivery:public.delivery_7_days:a&withDownstream=true
145
+
146
+
```
147
+
This will include `outEdges` within the returned node of the graph.
148
+
149
+
105
150
### Point in time upstream lineage
106
-
return historical upstream lineage from a given Dataset version.
107
-
This adds the version element to the nodeId in both the existing `/api/v1/lineage` and newly proposed `/api/v1/column-lineage` endpoint
151
+
152
+
Changes related to `/api/v1/lineage` are out of scope of this proposal which will only include point in time lineage for newly proposed `/api/v1/column-lineage` endpoint:
108
153
```
109
-
GET /lineage?nodeId=dataset:food_delivery:public.delivery_7_days:{version}
110
-
GET /column-lineage?nodeId=dataset:food_delivery:public.delivery_7_days:{version}&column=a
154
+
GET /column-lineage?nodeId=dataset_field:food_delivery:public.delivery_7_days:a&datasetVersion=123e4567-e89b-12d3-a456-426614174000
155
+
GET /column-lineage?nodeId=dataset_field:food_delivery:public.delivery_7_days:a&lineageAt=1661846242
111
156
```
112
-
This returns only upstream lineage in this current proposal. This is because upstream lineage is well defined to a specific version while downstream lineage is not. The data payload would add a version field.
157
+
158
+
Point in time can be controlled by:
159
+
***datasetVersion** - uuid of a specific dataset version,
160
+
***lineageAt** - which contains a unix timestamp.
161
+
162
+
When **lineageAt** specified, the latest dataset version before timestamp will be found. Regardles **datasetVersion** or **lineageAt** parameters applied, responses will be the same as below:
Adding the columnLineage facet requires a formatting of existing facet data.
179
+
Adding the columnLineage facet requires a formatting of existing facet data (work in progress).
135
180
### column lineage endpoint
136
181
The `/column-lineage` endpoint leverages the `/lineage` endpoint and then filters down the payload to return the expected result.
137
182
### point-in-time upstream lineage
183
+
138
184
The point-in-time upstream lineage leverages the run to dataset version relation to track back the lineage of a given dataset of job version.
139
185
Dataset version -> run that produced it -> consumed Dataset Versions.
140
186
141
187
## Next Steps
142
188
143
-
Review of this proposal and production of detailed design for the implementation, in particular for the point in time lineage which might affect the dabtabase schema.
189
+
Review of this proposal and production of detailed design for the implementation.:
0 commit comments