Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions bom/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ dependencies {
api(project(":polaris-config-docs-generator"))

api(project(":polaris-core"))
api(project(":polaris-extensions-lineage"))

api(project(":polaris-relational-jdbc"))

Expand Down
42 changes: 42 additions & 0 deletions extensions/lineage/build.gradle.kts
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(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The 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 polaris-core code.

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 polaris-core code?

@iting0321 iting0321 Jun 22, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The 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(
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"));
}
Comment thread
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"));
}
Comment thread
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
}
Loading