-
Notifications
You must be signed in to change notification settings - Fork 460
OpenLineage : Add core lineage service scaffolding #4705
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
iting0321
wants to merge
8
commits into
apache:main
Choose a base branch
from
iting0321:ol-core-spi-domain-model-1
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 5 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
b9265f0
add Core SPI and domain model
d630a09
update the node type
c073aae
add lineage data field
b85e227
fix the DefaultLineageServiceTest.java for feature is dark coverage
c8bd140
refactor LineagePersistence
a793842
remove jakarta.annotation.Nullable
00c432a
add lineage feature configurations to documentation
bf4c5d9
remove persistence-related model
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
polaris-core/src/main/java/org/apache/polaris/core/lineage/LineageColumnEdge.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one | ||
| * or more contributor license agreements. See the NOTICE file | ||
| * distributed with this work for additional information | ||
| * regarding copyright ownership. The ASF licenses this file | ||
| * to you under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance | ||
| * with the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
| package org.apache.polaris.core.lineage; | ||
|
|
||
| import java.util.Objects; | ||
|
|
||
| /** A field-level lineage relationship between two dataset columns. */ | ||
| public record LineageColumnEdge(LineageFieldReference source, LineageFieldReference target) { | ||
| public LineageColumnEdge { | ||
| Objects.requireNonNull(source, "source must be non-null"); | ||
| Objects.requireNonNull(target, "target must be non-null"); | ||
| } | ||
| } |
71 changes: 71 additions & 0 deletions
71
polaris-core/src/main/java/org/apache/polaris/core/lineage/LineageData.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one | ||
| * or more contributor license agreements. See the NOTICE file | ||
| * distributed with this work for additional information | ||
| * regarding copyright ownership. The ASF licenses this file | ||
| * to you under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance | ||
| * with the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
| package org.apache.polaris.core.lineage; | ||
|
|
||
| import jakarta.annotation.Nullable; | ||
| import java.util.Objects; | ||
| import java.util.OptionalLong; | ||
|
|
||
| /** Dataset metadata returned in a lineage query response. */ | ||
| public record LineageData( | ||
| OptionalLong catalogId, | ||
| OptionalLong datasetId, | ||
| String namespace, | ||
| String name, | ||
| @Nullable String subType, | ||
| OptionalLong createdAt, | ||
| OptionalLong updatedAt) { | ||
| public LineageData { | ||
| Objects.requireNonNull(catalogId, "catalogId must be non-null"); | ||
| Objects.requireNonNull(datasetId, "datasetId must be non-null"); | ||
| Objects.requireNonNull(namespace, "namespace must be non-null"); | ||
| Objects.requireNonNull(name, "name must be non-null"); | ||
| Objects.requireNonNull(createdAt, "createdAt must be non-null"); | ||
| Objects.requireNonNull(updatedAt, "updatedAt must be non-null"); | ||
| } | ||
|
|
||
| public LineageData( | ||
| long catalogId, | ||
| long datasetId, | ||
| String namespace, | ||
| String name, | ||
| @Nullable String subType, | ||
| long createdAt, | ||
| long updatedAt) { | ||
| this( | ||
| OptionalLong.of(catalogId), | ||
| OptionalLong.of(datasetId), | ||
| namespace, | ||
| name, | ||
| subType, | ||
| OptionalLong.of(createdAt), | ||
| OptionalLong.of(updatedAt)); | ||
| } | ||
|
|
||
| public LineageData(LineageDataset dataset) { | ||
| this( | ||
| OptionalLong.empty(), | ||
| dataset.polarisEntityId(), | ||
| dataset.namespace(), | ||
| dataset.name(), | ||
| null, | ||
| OptionalLong.empty(), | ||
| OptionalLong.empty()); | ||
| } | ||
| } |
37 changes: 37 additions & 0 deletions
37
polaris-core/src/main/java/org/apache/polaris/core/lineage/LineageDataset.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one | ||
| * or more contributor license agreements. See the NOTICE file | ||
| * distributed with this work for additional information | ||
| * regarding copyright ownership. The ASF licenses this file | ||
| * to you under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance | ||
| * with the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
| package org.apache.polaris.core.lineage; | ||
|
|
||
| import java.util.Objects; | ||
| import java.util.OptionalLong; | ||
|
|
||
| /** A dataset participating in lineage. */ | ||
| public record LineageDataset( | ||
| String catalog, String namespace, String name, OptionalLong polarisEntityId) { | ||
| public LineageDataset { | ||
| Objects.requireNonNull(catalog, "catalog must be non-null"); | ||
| Objects.requireNonNull(namespace, "namespace must be non-null"); | ||
| Objects.requireNonNull(name, "name must be non-null"); | ||
| Objects.requireNonNull(polarisEntityId, "polarisEntityId must be non-null"); | ||
| } | ||
|
|
||
| public LineageDataset(String catalog, String namespace, String name) { | ||
| this(catalog, namespace, name, OptionalLong.empty()); | ||
| } | ||
| } |
26 changes: 26 additions & 0 deletions
26
polaris-core/src/main/java/org/apache/polaris/core/lineage/LineageDirection.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one | ||
| * or more contributor license agreements. See the NOTICE file | ||
| * distributed with this work for additional information | ||
| * regarding copyright ownership. The ASF licenses this file | ||
| * to you under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance | ||
| * with the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
| package org.apache.polaris.core.lineage; | ||
|
|
||
| /** Supported directions for lineage queries. */ | ||
| public enum LineageDirection { | ||
| UPSTREAM, | ||
| DOWNSTREAM, | ||
| BOTH | ||
| } |
29 changes: 29 additions & 0 deletions
29
polaris-core/src/main/java/org/apache/polaris/core/lineage/LineageEdge.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one | ||
| * or more contributor license agreements. See the NOTICE file | ||
| * distributed with this work for additional information | ||
| * regarding copyright ownership. The ASF licenses this file | ||
| * to you under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance | ||
| * with the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
| package org.apache.polaris.core.lineage; | ||
|
|
||
| import java.util.Objects; | ||
|
|
||
| /** A dataset-level lineage relationship. */ | ||
| public record LineageEdge(LineageDataset source, LineageDataset target) { | ||
| public LineageEdge { | ||
| Objects.requireNonNull(source, "source must be non-null"); | ||
| Objects.requireNonNull(target, "target must be non-null"); | ||
| } | ||
| } |
33 changes: 33 additions & 0 deletions
33
polaris-core/src/main/java/org/apache/polaris/core/lineage/LineageFieldMapping.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one | ||
| * or more contributor license agreements. See the NOTICE file | ||
| * distributed with this work for additional information | ||
| * regarding copyright ownership. The ASF licenses this file | ||
| * to you under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance | ||
| * with the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
| package org.apache.polaris.core.lineage; | ||
|
|
||
| import java.util.Objects; | ||
|
|
||
| /** A source-to-target field mapping returned for column-granularity queries. */ | ||
| public record LineageFieldMapping(String sourceField, String targetField) { | ||
| public LineageFieldMapping { | ||
| Objects.requireNonNull(sourceField, "sourceField must be non-null"); | ||
| Objects.requireNonNull(targetField, "targetField must be non-null"); | ||
| } | ||
|
|
||
| public LineageFieldMapping(LineageColumnEdge edge) { | ||
| this(edge.source().field(), edge.target().field()); | ||
| } | ||
| } |
29 changes: 29 additions & 0 deletions
29
polaris-core/src/main/java/org/apache/polaris/core/lineage/LineageFieldReference.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one | ||
| * or more contributor license agreements. See the NOTICE file | ||
| * distributed with this work for additional information | ||
| * regarding copyright ownership. The ASF licenses this file | ||
| * to you under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance | ||
| * with the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
| package org.apache.polaris.core.lineage; | ||
|
|
||
| import java.util.Objects; | ||
|
|
||
| /** A reference to a specific field on a lineage dataset. */ | ||
| public record LineageFieldReference(LineageDataset dataset, String field) { | ||
| public LineageFieldReference { | ||
| Objects.requireNonNull(dataset, "dataset must be non-null"); | ||
| Objects.requireNonNull(field, "field must be non-null"); | ||
| } | ||
| } |
25 changes: 25 additions & 0 deletions
25
polaris-core/src/main/java/org/apache/polaris/core/lineage/LineageGranularity.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one | ||
| * or more contributor license agreements. See the NOTICE file | ||
| * distributed with this work for additional information | ||
| * regarding copyright ownership. The ASF licenses this file | ||
| * to you under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance | ||
| * with the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
| package org.apache.polaris.core.lineage; | ||
|
|
||
| /** Supported query granularities for lineage lookups. */ | ||
| public enum LineageGranularity { | ||
| DATASET, | ||
| COLUMN | ||
| } |
32 changes: 32 additions & 0 deletions
32
polaris-core/src/main/java/org/apache/polaris/core/lineage/LineageGraph.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one | ||
| * or more contributor license agreements. See the NOTICE file | ||
| * distributed with this work for additional information | ||
| * regarding copyright ownership. The ASF licenses this file | ||
| * to you under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance | ||
| * with the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
| package org.apache.polaris.core.lineage; | ||
|
|
||
| import java.util.List; | ||
| import java.util.Objects; | ||
|
|
||
| /** Normalized response model for lineage queries. */ | ||
| public record LineageGraph( | ||
| LineageNode node, List<LineageNode> upstream, List<LineageNode> downstream) { | ||
| public LineageGraph { | ||
| Objects.requireNonNull(node, "node must be non-null"); | ||
| upstream = List.copyOf(upstream); | ||
| downstream = List.copyOf(downstream); | ||
| } | ||
| } | ||
38 changes: 38 additions & 0 deletions
38
polaris-core/src/main/java/org/apache/polaris/core/lineage/LineageIngestRequest.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one | ||
| * or more contributor license agreements. See the NOTICE file | ||
| * distributed with this work for additional information | ||
| * regarding copyright ownership. The ASF licenses this file | ||
| * to you under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance | ||
| * with the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
| package org.apache.polaris.core.lineage; | ||
|
|
||
| import java.time.Instant; | ||
| import java.util.List; | ||
| import java.util.Objects; | ||
| import java.util.Optional; | ||
|
|
||
| /** Extracted lineage payload that can be persisted independent of the transport event shape. */ | ||
| public record LineageIngestRequest( | ||
| List<LineageDataset> datasets, | ||
| List<LineageEdge> edges, | ||
| List<LineageColumnEdge> columnEdges, | ||
| Optional<Instant> eventTime) { | ||
| public LineageIngestRequest { | ||
| datasets = List.copyOf(datasets); | ||
| edges = List.copyOf(edges); | ||
| columnEdges = List.copyOf(columnEdges); | ||
| Objects.requireNonNull(eventTime, "eventTime must be non-null"); | ||
| } | ||
|
iting0321 marked this conversation as resolved.
Outdated
|
||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed