diff --git a/catalogs/catalog-jdbc/build.gradle.kts b/catalogs/catalog-jdbc-common/build.gradle.kts similarity index 74% rename from catalogs/catalog-jdbc/build.gradle.kts rename to catalogs/catalog-jdbc-common/build.gradle.kts index 26a9400a409..54ab9fd1fdd 100644 --- a/catalogs/catalog-jdbc/build.gradle.kts +++ b/catalogs/catalog-jdbc-common/build.gradle.kts @@ -2,7 +2,7 @@ * Copyright 2023 Datastrato. * This software is licensed under the Apache License version 2. */ -description = "catalog-jdbc" +description = "catalog-jdbc-common" plugins { `maven-publish` @@ -15,7 +15,6 @@ dependencies { implementation(project(":common")) implementation(project(":core")) implementation(project(":api")) - implementation(project(":server-common")) implementation(libs.jackson.databind) implementation(libs.jackson.annotations) implementation(libs.jackson.datatype.jdk8) @@ -35,21 +34,9 @@ dependencies { exclude("com.google.code.findbugs") exclude("org.slf4j") } - implementation(libs.sqlite.jdbc) compileOnly(libs.lombok) annotationProcessor(libs.lombok) - - testImplementation(libs.junit.jupiter.api) - testImplementation(libs.junit.jupiter.params) - testRuntimeOnly(libs.junit.jupiter.engine) - testImplementation(libs.mockito.core) - testImplementation(libs.jersey.test.framework.core) { - exclude(group = "org.junit.jupiter") - } - testImplementation(libs.jersey.test.framework.provider.jetty) { - exclude(group = "org.junit.jupiter") - } } tasks { @@ -60,12 +47,12 @@ tasks { val copyCatalogLibs by registering(Copy::class) { dependsOn(copyDepends, "build") from("build/libs") - into("${rootDir}/distribution/package/catalogs/jdbc/libs") + into("${rootDir}/distribution/package/catalogs/jdbc-common/libs") } val copyCatalogConfig by registering(Copy::class) { from("src/main/resources") - into("${rootDir}/distribution/package/catalogs/jdbc/conf") + into("${rootDir}/distribution/package/catalogs/jdbc-common/conf") include("jdbc.properties") rename { original -> if (original.endsWith(".template")) { diff --git a/catalogs/catalog-jdbc/src/main/java/com/datastrato/gravitino/catalog/jdbc/JdbcCatalog.java b/catalogs/catalog-jdbc-common/src/main/java/com/datastrato/gravitino/catalog/jdbc/JdbcCatalog.java similarity index 87% rename from catalogs/catalog-jdbc/src/main/java/com/datastrato/gravitino/catalog/jdbc/JdbcCatalog.java rename to catalogs/catalog-jdbc-common/src/main/java/com/datastrato/gravitino/catalog/jdbc/JdbcCatalog.java index 84cf8be8a79..14024fca0fb 100644 --- a/catalogs/catalog-jdbc/src/main/java/com/datastrato/gravitino/catalog/jdbc/JdbcCatalog.java +++ b/catalogs/catalog-jdbc-common/src/main/java/com/datastrato/gravitino/catalog/jdbc/JdbcCatalog.java @@ -11,13 +11,7 @@ import java.util.Map; /** Implementation of an Jdbc catalog in Gravitino. */ -public class JdbcCatalog extends BaseCatalog { - - /** @return The short name of the catalog. */ - @Override - public String shortName() { - return "jdbc"; - } +public abstract class JdbcCatalog extends BaseCatalog { /** * Creates a new instance of {@link JdbcCatalogOperations} with the provided configuration. diff --git a/catalogs/catalog-jdbc/src/main/java/com/datastrato/gravitino/catalog/jdbc/JdbcCatalogOperations.java b/catalogs/catalog-jdbc-common/src/main/java/com/datastrato/gravitino/catalog/jdbc/JdbcCatalogOperations.java similarity index 100% rename from catalogs/catalog-jdbc/src/main/java/com/datastrato/gravitino/catalog/jdbc/JdbcCatalogOperations.java rename to catalogs/catalog-jdbc-common/src/main/java/com/datastrato/gravitino/catalog/jdbc/JdbcCatalogOperations.java diff --git a/catalogs/catalog-jdbc/src/main/java/com/datastrato/gravitino/catalog/jdbc/JdbcCatalogPropertiesMetadata.java b/catalogs/catalog-jdbc-common/src/main/java/com/datastrato/gravitino/catalog/jdbc/JdbcCatalogPropertiesMetadata.java similarity index 100% rename from catalogs/catalog-jdbc/src/main/java/com/datastrato/gravitino/catalog/jdbc/JdbcCatalogPropertiesMetadata.java rename to catalogs/catalog-jdbc-common/src/main/java/com/datastrato/gravitino/catalog/jdbc/JdbcCatalogPropertiesMetadata.java diff --git a/catalogs/catalog-jdbc/src/main/java/com/datastrato/gravitino/catalog/jdbc/JdbcColumn.java b/catalogs/catalog-jdbc-common/src/main/java/com/datastrato/gravitino/catalog/jdbc/JdbcColumn.java similarity index 100% rename from catalogs/catalog-jdbc/src/main/java/com/datastrato/gravitino/catalog/jdbc/JdbcColumn.java rename to catalogs/catalog-jdbc-common/src/main/java/com/datastrato/gravitino/catalog/jdbc/JdbcColumn.java diff --git a/catalogs/catalog-jdbc/src/main/java/com/datastrato/gravitino/catalog/jdbc/JdbcSchema.java b/catalogs/catalog-jdbc-common/src/main/java/com/datastrato/gravitino/catalog/jdbc/JdbcSchema.java similarity index 80% rename from catalogs/catalog-jdbc/src/main/java/com/datastrato/gravitino/catalog/jdbc/JdbcSchema.java rename to catalogs/catalog-jdbc-common/src/main/java/com/datastrato/gravitino/catalog/jdbc/JdbcSchema.java index 63dbf23460e..bc611b9344f 100644 --- a/catalogs/catalog-jdbc/src/main/java/com/datastrato/gravitino/catalog/jdbc/JdbcSchema.java +++ b/catalogs/catalog-jdbc-common/src/main/java/com/datastrato/gravitino/catalog/jdbc/JdbcSchema.java @@ -19,10 +19,7 @@ public static class Builder extends BaseSchemaBuilder { protected JdbcSchema internalBuild() { JdbcSchema jdbcSchema = new JdbcSchema(); jdbcSchema.name = name; - jdbcSchema.comment = - null == comment - ? (null == properties ? null : properties.get(JdbcSchemaPropertiesMetadata.COMMENT)) - : comment; + jdbcSchema.comment = comment; jdbcSchema.properties = properties; jdbcSchema.auditInfo = auditInfo; return jdbcSchema; diff --git a/catalogs/catalog-jdbc/src/main/java/com/datastrato/gravitino/catalog/jdbc/JdbcSchemaPropertiesMetadata.java b/catalogs/catalog-jdbc-common/src/main/java/com/datastrato/gravitino/catalog/jdbc/JdbcSchemaPropertiesMetadata.java similarity index 91% rename from catalogs/catalog-jdbc/src/main/java/com/datastrato/gravitino/catalog/jdbc/JdbcSchemaPropertiesMetadata.java rename to catalogs/catalog-jdbc-common/src/main/java/com/datastrato/gravitino/catalog/jdbc/JdbcSchemaPropertiesMetadata.java index 4b270b72ee4..9c23070011e 100644 --- a/catalogs/catalog-jdbc/src/main/java/com/datastrato/gravitino/catalog/jdbc/JdbcSchemaPropertiesMetadata.java +++ b/catalogs/catalog-jdbc-common/src/main/java/com/datastrato/gravitino/catalog/jdbc/JdbcSchemaPropertiesMetadata.java @@ -10,6 +10,7 @@ import com.datastrato.gravitino.catalog.PropertyEntry; import com.google.common.collect.ImmutableList; import com.google.common.collect.Maps; +import java.util.Collections; import java.util.List; import java.util.Map; @@ -26,6 +27,6 @@ public class JdbcSchemaPropertiesMetadata extends BasePropertiesMetadata { @Override protected Map> specificPropertyEntries() { - return PROPERTIES_METADATA; + return Collections.unmodifiableMap(PROPERTIES_METADATA); } } diff --git a/catalogs/catalog-jdbc/src/main/java/com/datastrato/gravitino/catalog/jdbc/JdbcTable.java b/catalogs/catalog-jdbc-common/src/main/java/com/datastrato/gravitino/catalog/jdbc/JdbcTable.java similarity index 91% rename from catalogs/catalog-jdbc/src/main/java/com/datastrato/gravitino/catalog/jdbc/JdbcTable.java rename to catalogs/catalog-jdbc-common/src/main/java/com/datastrato/gravitino/catalog/jdbc/JdbcTable.java index 93a7357b21c..40996eff0d1 100644 --- a/catalogs/catalog-jdbc/src/main/java/com/datastrato/gravitino/catalog/jdbc/JdbcTable.java +++ b/catalogs/catalog-jdbc-common/src/main/java/com/datastrato/gravitino/catalog/jdbc/JdbcTable.java @@ -36,9 +36,6 @@ protected JdbcTable internalBuild() { jdbcTable.columns = columns; jdbcTable.partitions = partitions; jdbcTable.sortOrders = sortOrders; - if (null != comment) { - jdbcTable.properties.putIfAbsent(JDBC_COMMENT_FIELD_NAME, comment); - } return jdbcTable; } } diff --git a/catalogs/catalog-jdbc/src/main/java/com/datastrato/gravitino/catalog/jdbc/JdbcTablePropertiesMetadata.java b/catalogs/catalog-jdbc-common/src/main/java/com/datastrato/gravitino/catalog/jdbc/JdbcTablePropertiesMetadata.java similarity index 87% rename from catalogs/catalog-jdbc/src/main/java/com/datastrato/gravitino/catalog/jdbc/JdbcTablePropertiesMetadata.java rename to catalogs/catalog-jdbc-common/src/main/java/com/datastrato/gravitino/catalog/jdbc/JdbcTablePropertiesMetadata.java index fcba2aa8171..5445047bd56 100644 --- a/catalogs/catalog-jdbc/src/main/java/com/datastrato/gravitino/catalog/jdbc/JdbcTablePropertiesMetadata.java +++ b/catalogs/catalog-jdbc-common/src/main/java/com/datastrato/gravitino/catalog/jdbc/JdbcTablePropertiesMetadata.java @@ -6,13 +6,13 @@ import com.datastrato.gravitino.catalog.BasePropertiesMetadata; import com.datastrato.gravitino.catalog.PropertyEntry; -import java.util.HashMap; +import java.util.Collections; import java.util.Map; public class JdbcTablePropertiesMetadata extends BasePropertiesMetadata { @Override protected Map> specificPropertyEntries() { - return new HashMap<>(); + return Collections.emptyMap(); } } diff --git a/settings.gradle.kts b/settings.gradle.kts index 651da62aedd..9e0a6e1f58a 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -5,6 +5,6 @@ rootProject.name = "gravitino" include("api", "common", "core", "meta", "server", "integration-test", "server-common") -include("catalogs:catalog-hive", "catalogs:catalog-lakehouse-iceberg", "catalogs:catalog-jdbc") +include("catalogs:catalog-hive", "catalogs:catalog-lakehouse-iceberg", "catalogs:catalog-jdbc-common") include("clients:client-java", "clients:client-java-runtime") -include("trino-connector") \ No newline at end of file +include("trino-connector")