Skip to content
Merged
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
3 changes: 2 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -949,7 +949,8 @@ tasks {
":catalogs:catalog-lakehouse-hudi:copyLibAndConfig",
":catalogs:catalog-lakehouse-iceberg:copyLibAndConfig",
":catalogs:catalog-lakehouse-paimon:copyLibAndConfig",
":catalogs:catalog-model:copyLibAndConfig"
":catalogs:catalog-model:copyLibAndConfig",
":catalogs:catalog-generic-lakehouse:copyLibAndConfig"
)
}

Expand Down
125 changes: 125 additions & 0 deletions catalogs/catalog-generic-lakehouse/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
/*
* 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.
*/
description = "catalog-generic-lakehouse"

plugins {
`maven-publish`
id("java")
id("idea")
}

dependencies {
implementation(project(":api")) {
exclude("*")
}
implementation(project(":catalogs:catalog-common"))
implementation(project(":common")) {
exclude("*")
}
implementation(project(":core")) {
exclude("*")
}

implementation(libs.bundles.log4j)
implementation(libs.cglib)
implementation(libs.commons.collections4)
implementation(libs.commons.io)
implementation(libs.commons.lang3)
implementation(libs.guava)

annotationProcessor(libs.lombok)

compileOnly(libs.lombok)

testImplementation(project(":catalogs:catalog-jdbc-common", "testArtifacts"))
testImplementation(project(":clients:client-java"))
testImplementation(project(":integration-test-common", "testArtifacts"))
testImplementation(project(":server"))
testImplementation(project(":server-common"))

testImplementation(libs.junit.jupiter.api)
testImplementation(libs.junit.jupiter.params)
testImplementation(libs.mockito.core)
testImplementation(libs.mysql.driver)
testImplementation(libs.postgresql.driver)
testImplementation(libs.slf4j.api)
testImplementation(libs.testcontainers)
testImplementation(libs.testcontainers.mysql)
testImplementation(libs.testcontainers.postgresql)

testRuntimeOnly(libs.junit.jupiter.engine)
}

tasks {
val runtimeJars by registering(Copy::class) {
from(configurations.runtimeClasspath)
into("build/libs")
}

jar {
finalizedBy("runtimeJars")
}

val copyCatalogLibs by registering(Copy::class) {
dependsOn("jar", "runtimeJars")
from("build/libs") {
exclude("guava-*.jar")
exclude("log4j-*.jar")
exclude("slf4j-*.jar")
}
into("$rootDir/distribution/package/catalogs/generic-lakehouse/libs")
}

val copyCatalogConfig by registering(Copy::class) {
from("src/main/resources")
into("$rootDir/distribution/package/catalogs/generic-lakehouse/conf")

rename { original ->
if (original.endsWith(".template")) {
original.replace(".template", "")
} else {
original
}
}

exclude { details ->
details.file.isDirectory()
}

fileMode = 0b111101101
}

register("copyLibAndConfig", Copy::class) {
dependsOn(copyCatalogLibs, copyCatalogConfig)
}
}

tasks.test {
val skipITs = project.hasProperty("skipITs")
if (skipITs) {
// Exclude integration tests
exclude("**/integration/test/**")
} else {
dependsOn(tasks.jar)
}
}

tasks.getByName("generateMetadataFileForMavenJavaPublication") {
dependsOn("runtimeJars")
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
/*
* 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.gravitino.catalog.lakehouse;

import java.util.Map;
import org.apache.gravitino.connector.BaseCatalog;
import org.apache.gravitino.connector.CatalogOperations;
import org.apache.gravitino.connector.PropertiesMetadata;
import org.apache.gravitino.connector.capability.Capability;

/** Implementation of a generic lakehouse catalog in Apache Gravitino. */
public class GenericLakehouseCatalog extends BaseCatalog<GenericLakehouseCatalog> {

static final GenericLakehouseCatalogPropertiesMetadata CATALOG_PROPERTIES_METADATA =
new GenericLakehouseCatalogPropertiesMetadata();

static final GenericLakehouseSchemaPropertiesMetadata SCHEMA_PROPERTIES_METADATA =
new GenericLakehouseSchemaPropertiesMetadata();

static final GenericLakehouseTablePropertiesMetadata TABLE_PROPERTIES_METADATA =
new GenericLakehouseTablePropertiesMetadata();

/**
* Returns the short name of the generic lakehouse catalog.
*
* @return The short name of the catalog.
*/
@Override
public String shortName() {
return "generic-lakehouse";
}

/**
* Creates a new instance of {@link GenericLakehouseCatalogOperations} with the provided
* configuration.
*
* @param config The configuration map for the generic catalog operations.
* @return A new instance of {@link GenericLakehouseCatalogOperations}.
*/
@Override
protected CatalogOperations newOps(Map<String, String> config) {
return new GenericLakehouseCatalogOperations();
}

@Override
public Capability newCapability() {
return new GenericLakehouseCatalogCapability();
}

@Override
public PropertiesMetadata catalogPropertiesMetadata() throws UnsupportedOperationException {
return CATALOG_PROPERTIES_METADATA;
}

@Override
public PropertiesMetadata schemaPropertiesMetadata() throws UnsupportedOperationException {
return SCHEMA_PROPERTIES_METADATA;
}

@Override
public PropertiesMetadata tablePropertiesMetadata() throws UnsupportedOperationException {
return TABLE_PROPERTIES_METADATA;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/*
* 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.gravitino.catalog.lakehouse;

import org.apache.gravitino.connector.capability.Capability;
import org.apache.gravitino.connector.capability.CapabilityResult;

public class GenericLakehouseCatalogCapability implements Capability {

@Override
public CapabilityResult columnNotNull() {
throw new UnsupportedOperationException(
"Not implemented yet: GenericLakehouseCatalogCapability.columnNotNull");
}

@Override
public CapabilityResult columnDefaultValue() {
throw new UnsupportedOperationException(
"Not implemented yet: GenericLakehouseCatalogCapability.columnDefaultValue");
}

@Override
public CapabilityResult caseSensitiveOnName(Scope scope) {
switch (scope) {
case SCHEMA:
case TABLE:
case COLUMN:
throw new UnsupportedOperationException(
"Not implemented yet: GenericLakehouseCatalogCapability.caseSensitiveOnName");
default:
return CapabilityResult.SUPPORTED;
}
}
}
Loading
Loading