-
Notifications
You must be signed in to change notification settings - Fork 472
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
base: main
Are you sure you want to change the base?
Changes from 12 commits
b9265f0
d630a09
c073aae
b85e227
c8bd140
a793842
00c432a
bf4c5d9
1f17814
db746bb
b79394c
1e3400d
d73e506
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| /* | ||
| * 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. | ||
| */ | ||
|
|
||
| plugins { | ||
| id("polaris-client") | ||
| id("org.kordamp.gradle.jandex") | ||
| } | ||
|
|
||
| description = "Polaris lineage model and service contract" | ||
|
|
||
| dependencies { | ||
| implementation(project(":polaris-core")) | ||
|
|
||
| compileOnly(platform(libs.quarkus.bom)) | ||
| compileOnly("io.quarkus:quarkus-arc") | ||
| compileOnly(libs.jakarta.enterprise.cdi.api) | ||
| compileOnly(libs.jakarta.inject.api) | ||
| compileOnly(libs.smallrye.config.core) | ||
|
|
||
| testImplementation(platform(libs.junit.bom)) | ||
| testImplementation("org.junit.jupiter:junit-jupiter") | ||
| testImplementation(libs.assertj.core) | ||
| testImplementation(libs.mockito.core) | ||
| } | ||
|
|
||
| tasks.named("javadoc") { dependsOn("jandex") } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| /* | ||
| * 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.extensions.lineage; | ||
|
|
||
| import jakarta.enterprise.context.RequestScoped; | ||
| import jakarta.inject.Inject; | ||
| import org.apache.polaris.core.config.FeatureConfiguration; | ||
| import org.apache.polaris.core.context.CallContext; | ||
|
|
||
| @RequestScoped | ||
| public class DefaultPolarisLineageHandler implements PolarisLineageHandler { | ||
| private final CallContext callContext; | ||
| private final LineageConfiguration configuration; | ||
|
|
||
| @Inject | ||
| public DefaultPolarisLineageHandler(CallContext callContext, LineageConfiguration configuration) { | ||
| this.callContext = callContext; | ||
| this.configuration = configuration; | ||
| } | ||
|
|
||
| @Override | ||
| public LineageGraph query(LineageQueryRequest request) { | ||
| ensureEnabled(); | ||
| throw new UnsupportedOperationException("Lineage query is not implemented yet."); | ||
| } | ||
|
|
||
| private void ensureEnabled() { | ||
| if (!configuration.enabled()) { | ||
| throw new UnsupportedOperationException( | ||
| "Lineage is disabled: set polaris.lineage.enabled=true to enable it."); | ||
| } | ||
|
|
||
| if (!callContext.getRealmConfig().getConfig(FeatureConfiguration.ENABLE_LINEAGE)) { | ||
| throw new UnsupportedOperationException( | ||
| "Lineage realm feature is disabled: enable " | ||
| + FeatureConfiguration.ENABLE_LINEAGE.key() | ||
| + " in the realm feature configuration."); | ||
| } | ||
| } | ||
| } | ||
| 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.extensions.lineage; | ||
|
|
||
| import io.smallrye.config.ConfigMapping; | ||
| import io.smallrye.config.WithDefault; | ||
|
|
||
| @ConfigMapping(prefix = "polaris.lineage") | ||
| public interface LineageConfiguration { | ||
|
|
||
| @WithDefault("false") | ||
| boolean enabled(); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| /* | ||
| * 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.extensions.lineage; | ||
|
|
||
| import java.util.Objects; | ||
| import java.util.OptionalLong; | ||
|
|
||
| /** Dataset metadata returned in a lineage query response. */ | ||
| public record LineageData( | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These new classes do not appear to be required / used by the old In the spirit of modularization, I'd like to propose defining them in a separate gradle module / jar. Are there any plans for using these new classes in old
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for your feedback! I don’t currently see these classes being consumed by existing polaris-core code paths, they appear to be used only by the new lineage service boundary. So I agree they can be moved into a separate lineage module unless we expect core components to depend on them soon. |
||
| OptionalLong catalogId, | ||
| OptionalLong datasetId, | ||
| String namespace, | ||
| String name, | ||
| 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, | ||
| String subType, | ||
| long createdAt, | ||
| long updatedAt) { | ||
| this( | ||
| OptionalLong.of(catalogId), | ||
| OptionalLong.of(datasetId), | ||
| namespace, | ||
| name, | ||
| subType, | ||
| OptionalLong.of(createdAt), | ||
| OptionalLong.of(updatedAt)); | ||
| } | ||
| } | ||
| 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.extensions.lineage; | ||
|
|
||
| /** Supported directions for lineage queries. */ | ||
| public enum LineageDirection { | ||
| UPSTREAM, | ||
| DOWNSTREAM, | ||
| BOTH | ||
| } |
| 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.extensions.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"); | ||
| } | ||
| } |
| 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.extensions.lineage; | ||
|
|
||
| /** Supported query granularities for lineage lookups. */ | ||
| public enum LineageGranularity { | ||
| DATASET, | ||
| COLUMN | ||
| } |
| 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.extensions.lineage; | ||
|
|
||
| import java.util.List; | ||
| import java.util.Objects; | ||
|
|
||
| /** Normalized response model for lineage queries. */ | ||
| public record LineageGraph( | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This class and some others overlap with #4826 ... I'm a bit confused about the intended merge order 😅 What is the PR to be merge first? If there are dependencies, it would be nice to keep dependent PRs in the "draft" state for the sake of clarity.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for your notification! This is the first PR and #4826 is the second. And I will also add the order at the begin of PR description and turn the others into draft. |
||
| LineageNode node, List<LineageNode> upstream, List<LineageNode> downstream) { | ||
| public LineageGraph { | ||
| Objects.requireNonNull(node, "node must be non-null"); | ||
| upstream = List.copyOf(Objects.requireNonNull(upstream, "upstream must be non-null")); | ||
| downstream = List.copyOf(Objects.requireNonNull(downstream, "downstream must be non-null")); | ||
| } | ||
|
iting0321 marked this conversation as resolved.
|
||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| /* | ||
| * 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.extensions.lineage; | ||
|
|
||
| import java.util.List; | ||
| import java.util.Objects; | ||
|
|
||
| /** A node returned in a lineage query response. */ | ||
| public record LineageNode( | ||
| String id, | ||
| LineageNodeType type, | ||
| LineageData data, | ||
| boolean opaque, | ||
| List<LineageFieldMapping> fieldMappings) { | ||
| public LineageNode { | ||
| Objects.requireNonNull(id, "id must be non-null"); | ||
| Objects.requireNonNull(type, "type must be non-null"); | ||
| fieldMappings = | ||
| List.copyOf(Objects.requireNonNull(fieldMappings, "fieldMappings must be non-null")); | ||
| } | ||
|
iting0321 marked this conversation as resolved.
|
||
|
|
||
| public LineageNode(String id, LineageNodeType type, LineageData data, boolean opaque) { | ||
| this(id, type, data, opaque, List.of()); | ||
| } | ||
| } | ||
| 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.extensions.lineage; | ||
|
|
||
| /** Node kinds surfaced by normalized lineage queries. */ | ||
| public enum LineageNodeType { | ||
| DATASET, | ||
| COLUMN | ||
| } |
Uh oh!
There was an error while loading. Please reload this page.