Skip to content

Commit

Permalink
[#655] feat(jdbc): Initialize the JDBC module in Gravitino.
Browse files Browse the repository at this point in the history
  • Loading branch information
Clearvive authored and Clearvive committed Nov 6, 2023
1 parent 2abe779 commit eaa6225
Show file tree
Hide file tree
Showing 10 changed files with 11 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand All @@ -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)
Expand All @@ -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 {
Expand All @@ -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")) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,7 @@
import java.util.Map;

/** Implementation of an Jdbc catalog in Gravitino. */
public class JdbcCatalog extends BaseCatalog<JdbcCatalog> {

/** @return The short name of the catalog. */
@Override
public String shortName() {
return "jdbc";
}
public abstract class JdbcCatalog extends BaseCatalog<JdbcCatalog> {

/**
* Creates a new instance of {@link JdbcCatalogOperations} with the provided configuration.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,7 @@ public static class Builder extends BaseSchemaBuilder<Builder, JdbcSchema> {
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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -26,6 +27,6 @@ public class JdbcSchemaPropertiesMetadata extends BasePropertiesMetadata {

@Override
protected Map<String, PropertyEntry<?>> specificPropertyEntries() {
return PROPERTIES_METADATA;
return Collections.unmodifiableMap(PROPERTIES_METADATA);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<String, PropertyEntry<?>> specificPropertyEntries() {
return new HashMap<>();
return Collections.emptyMap();
}
}
4 changes: 2 additions & 2 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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")
include("trino-connector")

0 comments on commit eaa6225

Please sign in to comment.