This is an automated email from the ASF dual-hosted git repository. mchades pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/gravitino.git
The following commit(s) were added to refs/heads/main by this push: new 7c10cdeb3 Feature(jdbc-catalog):Add code skeleton for oceanbase-ce jdbc catalog (#4918) 7c10cdeb3 is described below commit 7c10cdeb37ed89c5b853fdde25a4fb8ddd40ec33 Author: yuanoOo <zhao137578...@gmail.com> AuthorDate: Thu Sep 19 12:52:53 2024 +0800 Feature(jdbc-catalog):Add code skeleton for oceanbase-ce jdbc catalog (#4918) ### What changes were proposed in this pull request? - add catalog-jdbc-oceanbase module - add code skeleton for oceanbase-ce jdbc catalog ### Why are the changes needed? Fix: #4916 ### Does this PR introduce _any_ user-facing change? no ### How was this patch tested? build pass. tests will be added in implementation PRs --- catalogs/catalog-jdbc-oceanbase/build.gradle.kts | 48 +++++++++ .../catalog/oceanbase/OceanBaseCatalog.java | 84 ++++++++++++++++ .../oceanbase/OceanBaseCatalogCapability.java | 51 ++++++++++ .../OceanBaseColumnDefaultValueConverter.java | 36 +++++++ .../converter/OceanBaseExceptionConverter.java | 33 +++++++ .../converter/OceanBaseTypeConverter.java | 40 ++++++++ .../operation/OceanBaseDatabaseOperations.java | 65 ++++++++++++ .../operation/OceanBaseTableOperations.java | 110 +++++++++++++++++++++ .../services/org.apache.gravitino.CatalogProvider | 19 ++++ .../src/main/resources/jdbc-oceanbase.conf | 22 +++++ .../src/test/resources/log4j2.properties | 70 +++++++++++++ settings.gradle.kts | 3 +- 12 files changed, 580 insertions(+), 1 deletion(-) diff --git a/catalogs/catalog-jdbc-oceanbase/build.gradle.kts b/catalogs/catalog-jdbc-oceanbase/build.gradle.kts new file mode 100644 index 000000000..2183edbd9 --- /dev/null +++ b/catalogs/catalog-jdbc-oceanbase/build.gradle.kts @@ -0,0 +1,48 @@ +/* + * 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-jdbc-oceanbase" + +plugins { + `maven-publish` + id("java") + id("idea") +} + +dependencies { + implementation(project(":api")) { + exclude(group = "*") + } + implementation(project(":catalogs:catalog-common")) { + exclude(group = "*") + } + implementation(project(":catalogs:catalog-jdbc-common")) { + exclude(group = "*") + } + implementation(project(":common")) { + exclude(group = "*") + } + implementation(project(":core")) { + exclude(group = "*") + } + + implementation(libs.bundles.log4j) + implementation(libs.commons.collections4) + implementation(libs.commons.lang3) + implementation(libs.guava) +} diff --git a/catalogs/catalog-jdbc-oceanbase/src/main/java/org/apache/gravitino/catalog/oceanbase/OceanBaseCatalog.java b/catalogs/catalog-jdbc-oceanbase/src/main/java/org/apache/gravitino/catalog/oceanbase/OceanBaseCatalog.java new file mode 100644 index 000000000..6dbfeccc3 --- /dev/null +++ b/catalogs/catalog-jdbc-oceanbase/src/main/java/org/apache/gravitino/catalog/oceanbase/OceanBaseCatalog.java @@ -0,0 +1,84 @@ +/* + * 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.oceanbase; + +import java.util.Map; +import org.apache.gravitino.catalog.jdbc.JdbcCatalog; +import org.apache.gravitino.catalog.jdbc.JdbcCatalogOperations; +import org.apache.gravitino.catalog.jdbc.converter.JdbcColumnDefaultValueConverter; +import org.apache.gravitino.catalog.jdbc.converter.JdbcExceptionConverter; +import org.apache.gravitino.catalog.jdbc.converter.JdbcTypeConverter; +import org.apache.gravitino.catalog.jdbc.operation.JdbcDatabaseOperations; +import org.apache.gravitino.catalog.jdbc.operation.JdbcTableOperations; +import org.apache.gravitino.catalog.oceanbase.converter.OceanBaseColumnDefaultValueConverter; +import org.apache.gravitino.catalog.oceanbase.converter.OceanBaseExceptionConverter; +import org.apache.gravitino.catalog.oceanbase.converter.OceanBaseTypeConverter; +import org.apache.gravitino.catalog.oceanbase.operation.OceanBaseDatabaseOperations; +import org.apache.gravitino.catalog.oceanbase.operation.OceanBaseTableOperations; +import org.apache.gravitino.connector.CatalogOperations; +import org.apache.gravitino.connector.capability.Capability; + +/** Implementation of a OceanBase catalog in Apache Gravitino. */ +public class OceanBaseCatalog extends JdbcCatalog { + + @Override + public String shortName() { + return "jdbc-oceanbase"; + } + + @Override + protected CatalogOperations newOps(Map<String, String> config) { + return new JdbcCatalogOperations( + createExceptionConverter(), + createJdbcTypeConverter(), + createJdbcDatabaseOperations(), + createJdbcTableOperations(), + createJdbcColumnDefaultValueConverter()); + } + + @Override + public Capability newCapability() { + return new OceanBaseCatalogCapability(); + } + + @Override + protected JdbcExceptionConverter createExceptionConverter() { + return new OceanBaseExceptionConverter(); + } + + @Override + protected JdbcTypeConverter createJdbcTypeConverter() { + return new OceanBaseTypeConverter(); + } + + @Override + protected JdbcDatabaseOperations createJdbcDatabaseOperations() { + return new OceanBaseDatabaseOperations(); + } + + @Override + protected JdbcTableOperations createJdbcTableOperations() { + return new OceanBaseTableOperations(); + } + + @Override + protected JdbcColumnDefaultValueConverter createJdbcColumnDefaultValueConverter() { + return new OceanBaseColumnDefaultValueConverter(); + } +} diff --git a/catalogs/catalog-jdbc-oceanbase/src/main/java/org/apache/gravitino/catalog/oceanbase/OceanBaseCatalogCapability.java b/catalogs/catalog-jdbc-oceanbase/src/main/java/org/apache/gravitino/catalog/oceanbase/OceanBaseCatalogCapability.java new file mode 100644 index 000000000..03cb6a375 --- /dev/null +++ b/catalogs/catalog-jdbc-oceanbase/src/main/java/org/apache/gravitino/catalog/oceanbase/OceanBaseCatalogCapability.java @@ -0,0 +1,51 @@ +/* + * 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.oceanbase; + +import org.apache.gravitino.connector.capability.Capability; +import org.apache.gravitino.connector.capability.CapabilityResult; + +public class OceanBaseCatalogCapability implements Capability { + + /** + * Regular expression explanation: ^[\w\p{L}-$/=]{1,64}$ + * + * <p>^ - Start of the string + * + * <p>[\w\p{L}-$/=]{1,64} - Consist of 1 to 64 characters of letters (both cases), digits, + * underscores, any kind of letter from any language, hyphens, dollar signs, slashes or equal + * signs + * + * <p>\w - matches [a-zA-Z0-9_] + * + * <p>\p{L} - matches any kind of letter from any language + * + * <p>$ - End of the string + */ + public static final String OCEANBASE_NAME_PATTERN = "^[\\w\\p{L}-$/=]{1,64}$"; + + @Override + public CapabilityResult specificationOnName(Scope scope, String name) { + if (!name.matches(OCEANBASE_NAME_PATTERN)) { + return CapabilityResult.unsupported( + String.format("The %s name '%s' is illegal.", scope, name)); + } + return CapabilityResult.SUPPORTED; + } +} diff --git a/catalogs/catalog-jdbc-oceanbase/src/main/java/org/apache/gravitino/catalog/oceanbase/converter/OceanBaseColumnDefaultValueConverter.java b/catalogs/catalog-jdbc-oceanbase/src/main/java/org/apache/gravitino/catalog/oceanbase/converter/OceanBaseColumnDefaultValueConverter.java new file mode 100644 index 000000000..0f6fae44f --- /dev/null +++ b/catalogs/catalog-jdbc-oceanbase/src/main/java/org/apache/gravitino/catalog/oceanbase/converter/OceanBaseColumnDefaultValueConverter.java @@ -0,0 +1,36 @@ +/* + * 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.oceanbase.converter; + +import org.apache.gravitino.catalog.jdbc.converter.JdbcColumnDefaultValueConverter; +import org.apache.gravitino.catalog.jdbc.converter.JdbcTypeConverter; +import org.apache.gravitino.exceptions.GravitinoRuntimeException; +import org.apache.gravitino.rel.expressions.Expression; + +public class OceanBaseColumnDefaultValueConverter extends JdbcColumnDefaultValueConverter { + + @Override + public Expression toGravitino( + JdbcTypeConverter.JdbcTypeBean type, + String columnDefaultValue, + boolean isExpression, + boolean nullable) { + throw new GravitinoRuntimeException("Not implemented yet."); + } +} diff --git a/catalogs/catalog-jdbc-oceanbase/src/main/java/org/apache/gravitino/catalog/oceanbase/converter/OceanBaseExceptionConverter.java b/catalogs/catalog-jdbc-oceanbase/src/main/java/org/apache/gravitino/catalog/oceanbase/converter/OceanBaseExceptionConverter.java new file mode 100644 index 000000000..102e7abca --- /dev/null +++ b/catalogs/catalog-jdbc-oceanbase/src/main/java/org/apache/gravitino/catalog/oceanbase/converter/OceanBaseExceptionConverter.java @@ -0,0 +1,33 @@ +/* + * 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.oceanbase.converter; + +import java.sql.SQLException; +import org.apache.gravitino.catalog.jdbc.converter.JdbcExceptionConverter; +import org.apache.gravitino.exceptions.GravitinoRuntimeException; + +/** Exception converter to Apache Gravitino exception for OceanBase. */ +public class OceanBaseExceptionConverter extends JdbcExceptionConverter { + + @SuppressWarnings("FormatStringAnnotation") + @Override + public GravitinoRuntimeException toGravitinoException(SQLException se) { + return new GravitinoRuntimeException("Not implemented yet."); + } +} diff --git a/catalogs/catalog-jdbc-oceanbase/src/main/java/org/apache/gravitino/catalog/oceanbase/converter/OceanBaseTypeConverter.java b/catalogs/catalog-jdbc-oceanbase/src/main/java/org/apache/gravitino/catalog/oceanbase/converter/OceanBaseTypeConverter.java new file mode 100644 index 000000000..a13d1fe8f --- /dev/null +++ b/catalogs/catalog-jdbc-oceanbase/src/main/java/org/apache/gravitino/catalog/oceanbase/converter/OceanBaseTypeConverter.java @@ -0,0 +1,40 @@ +/* + * 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.oceanbase.converter; + +import org.apache.gravitino.catalog.jdbc.converter.JdbcTypeConverter; +import org.apache.gravitino.exceptions.GravitinoRuntimeException; +import org.apache.gravitino.rel.types.Type; + +/** Type converter for OceanBase. */ +public class OceanBaseTypeConverter extends JdbcTypeConverter { + + // More data types will be added. + static final String TINYINT = "tinyint"; + + @Override + public Type toGravitino(JdbcTypeBean typeBean) { + throw new GravitinoRuntimeException("Not implemented yet."); + } + + @Override + public String fromGravitino(Type type) { + throw new GravitinoRuntimeException("Not implemented yet."); + } +} diff --git a/catalogs/catalog-jdbc-oceanbase/src/main/java/org/apache/gravitino/catalog/oceanbase/operation/OceanBaseDatabaseOperations.java b/catalogs/catalog-jdbc-oceanbase/src/main/java/org/apache/gravitino/catalog/oceanbase/operation/OceanBaseDatabaseOperations.java new file mode 100644 index 000000000..a2eff259b --- /dev/null +++ b/catalogs/catalog-jdbc-oceanbase/src/main/java/org/apache/gravitino/catalog/oceanbase/operation/OceanBaseDatabaseOperations.java @@ -0,0 +1,65 @@ +/* + * 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.oceanbase.operation; + +import java.util.Collections; +import java.util.HashSet; +import java.util.Locale; +import java.util.Map; +import java.util.Set; +import org.apache.gravitino.catalog.jdbc.JdbcSchema; +import org.apache.gravitino.catalog.jdbc.operation.JdbcDatabaseOperations; +import org.apache.gravitino.exceptions.NoSuchSchemaException; + +/** Database operations for OceanBase. */ +public class OceanBaseDatabaseOperations extends JdbcDatabaseOperations { + + public static final Set<String> SYS_OCEANBASE_DATABASE_NAMES = createSysOceanBaseDatabaseNames(); + + private static Set<String> createSysOceanBaseDatabaseNames() { + Set<String> set = new HashSet<>(); + set.add("information_schema"); + set.add("mysql"); + set.add("sys"); + set.add("oceanbase"); + return Collections.unmodifiableSet(set); + } + + @Override + public String generateCreateDatabaseSql( + String databaseName, String comment, Map<String, String> properties) { + + throw new UnsupportedOperationException("Not implemented yet."); + } + + @Override + public String generateDropDatabaseSql(String databaseName, boolean cascade) { + throw new UnsupportedOperationException("Not implemented yet."); + } + + @Override + public JdbcSchema load(String databaseName) throws NoSuchSchemaException { + throw new UnsupportedOperationException("Not implemented yet."); + } + + @Override + protected boolean isSystemDatabase(String dbName) { + return SYS_OCEANBASE_DATABASE_NAMES.contains(dbName.toLowerCase(Locale.ROOT)); + } +} diff --git a/catalogs/catalog-jdbc-oceanbase/src/main/java/org/apache/gravitino/catalog/oceanbase/operation/OceanBaseTableOperations.java b/catalogs/catalog-jdbc-oceanbase/src/main/java/org/apache/gravitino/catalog/oceanbase/operation/OceanBaseTableOperations.java new file mode 100644 index 000000000..b1744a0c6 --- /dev/null +++ b/catalogs/catalog-jdbc-oceanbase/src/main/java/org/apache/gravitino/catalog/oceanbase/operation/OceanBaseTableOperations.java @@ -0,0 +1,110 @@ +/* + * 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.oceanbase.operation; + +import java.sql.Connection; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.List; +import java.util.Map; +import org.apache.commons.lang3.ArrayUtils; +import org.apache.gravitino.catalog.jdbc.JdbcColumn; +import org.apache.gravitino.catalog.jdbc.JdbcTable; +import org.apache.gravitino.catalog.jdbc.operation.JdbcTableOperations; +import org.apache.gravitino.exceptions.GravitinoRuntimeException; +import org.apache.gravitino.exceptions.NoSuchSchemaException; +import org.apache.gravitino.exceptions.NoSuchTableException; +import org.apache.gravitino.rel.TableChange; +import org.apache.gravitino.rel.expressions.distributions.Distribution; +import org.apache.gravitino.rel.expressions.transforms.Transform; +import org.apache.gravitino.rel.indexes.Index; + +/** Table operations for OceanBase. */ +public class OceanBaseTableOperations extends JdbcTableOperations { + + @Override + public List<String> listTables(String databaseName) throws NoSuchSchemaException { + throw new GravitinoRuntimeException("Not implemented yet."); + } + + @Override + public JdbcTable load(String databaseName, String tableName) throws NoSuchTableException { + return super.load(databaseName, tableName.toLowerCase()); + } + + @Override + protected String generateCreateTableSql( + String tableName, + JdbcColumn[] columns, + String comment, + Map<String, String> properties, + Transform[] partitioning, + Distribution distribution, + Index[] indexes) { + if (ArrayUtils.isNotEmpty(partitioning)) { + throw new UnsupportedOperationException("Currently not support Partition tables."); + } + + throw new UnsupportedOperationException("Not implemented yet."); + } + + @Override + protected boolean getAutoIncrementInfo(ResultSet resultSet) throws SQLException { + return "YES".equalsIgnoreCase(resultSet.getString("IS_AUTOINCREMENT")); + } + + @Override + protected Map<String, String> getTableProperties(Connection connection, String tableName) + throws SQLException { + throw new UnsupportedOperationException("Not implemented yet."); + } + + @Override + protected String generateRenameTableSql(String oldTableName, String newTableName) { + return String.format("RENAME TABLE `%s` TO `%s`", oldTableName, newTableName); + } + + @Override + protected String generateDropTableSql(String tableName) { + return String.format("DROP TABLE `%s`", tableName); + } + + @Override + protected String generatePurgeTableSql(String tableName) { + return String.format("TRUNCATE TABLE `%s`", tableName); + } + + @Override + public void alterTable(String databaseName, String tableName, TableChange... changes) + throws NoSuchTableException { + throw new UnsupportedOperationException("Not implemented yet."); + } + + @Override + protected String generateAlterTableSql( + String databaseName, String tableName, TableChange... changes) { + throw new UnsupportedOperationException("Not implemented yet."); + } + + @Override + protected JdbcTable getOrCreateTable( + String databaseName, String tableName, JdbcTable lazyLoadCreateTable) { + return null != lazyLoadCreateTable ? lazyLoadCreateTable : load(databaseName, tableName); + } +} diff --git a/catalogs/catalog-jdbc-oceanbase/src/main/resources/META-INF/services/org.apache.gravitino.CatalogProvider b/catalogs/catalog-jdbc-oceanbase/src/main/resources/META-INF/services/org.apache.gravitino.CatalogProvider new file mode 100644 index 000000000..09f083891 --- /dev/null +++ b/catalogs/catalog-jdbc-oceanbase/src/main/resources/META-INF/services/org.apache.gravitino.CatalogProvider @@ -0,0 +1,19 @@ +# +# 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. +# +org.apache.gravitino.catalog.oceanbase.OceanBaseCatalog \ No newline at end of file diff --git a/catalogs/catalog-jdbc-oceanbase/src/main/resources/jdbc-oceanbase.conf b/catalogs/catalog-jdbc-oceanbase/src/main/resources/jdbc-oceanbase.conf new file mode 100644 index 000000000..25786097a --- /dev/null +++ b/catalogs/catalog-jdbc-oceanbase/src/main/resources/jdbc-oceanbase.conf @@ -0,0 +1,22 @@ +# +# 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. +# +# jdbc-url = jdbc:mysql://localhost:2881/ +# jdbc-user = oceanbase +# jdbc-password = oceanbase +# jdbc-driver = com.mysql.jdbc.Driver \ No newline at end of file diff --git a/catalogs/catalog-jdbc-oceanbase/src/test/resources/log4j2.properties b/catalogs/catalog-jdbc-oceanbase/src/test/resources/log4j2.properties new file mode 100644 index 000000000..7312a5d12 --- /dev/null +++ b/catalogs/catalog-jdbc-oceanbase/src/test/resources/log4j2.properties @@ -0,0 +1,70 @@ +# +# 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. +# + +# Set to debug or trace if log4j initialization is failing +status = info + +# Name of the configuration +name = ConsoleLogConfig + +# Console appender configuration +appender.console.type = Console +appender.console.name = consoleLogger +appender.console.layout.type = PatternLayout +appender.console.layout.pattern = %d{yyyy-MM-dd HH:mm:ss} %-5p [%t] %c{1}:%L - %m%n + +# Log files location +property.logPath = ${sys:gravitino.log.path:-build/catalog-jdbc-oceanbase-integration-test.log} + +# File appender configuration +appender.file.type = File +appender.file.name = fileLogger +appender.file.fileName = ${logPath} +appender.file.layout.type = PatternLayout +appender.file.layout.pattern = %d{yyyy-MM-dd HH:mm:ss} %-5p [%t] %c{1}:%L - %m%n + +# Root logger level +rootLogger.level = info + +# Root logger referring to console and file appenders +rootLogger.appenderRef.stdout.ref = consoleLogger +rootLogger.appenderRef.file.ref = fileLogger + +# File appender configuration for testcontainers +appender.testcontainersFile.type = File +appender.testcontainersFile.name = testcontainersLogger +appender.testcontainersFile.fileName = build/testcontainers.log +appender.testcontainersFile.layout.type = PatternLayout +appender.testcontainersFile.layout.pattern = %d{yyyy-MM-dd HH:mm:ss.SSS} [%t] %-5p %c - %m%n + +# Logger for testcontainers +logger.testcontainers.name = org.testcontainers +logger.testcontainers.level = debug +logger.testcontainers.appenderRef.file.ref = testcontainersLogger + +logger.tc.name = tc +logger.tc.level = debug +logger.tc.appenderRef.file.ref = testcontainersLogger + +logger.docker.name = com.github.dockerjava +logger.docker.level = warn +logger.docker.appenderRef.file.ref = testcontainersLogger + +logger.http.name = com.github.dockerjava.zerodep.shaded.org.apache.hc.client5.http.wire +logger.http.level = off \ No newline at end of file diff --git a/settings.gradle.kts b/settings.gradle.kts index dc49f4867..e98f81d39 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -36,7 +36,8 @@ include( "catalogs:catalog-jdbc-common", "catalogs:catalog-jdbc-doris", "catalogs:catalog-jdbc-mysql", - "catalogs:catalog-jdbc-postgresql" + "catalogs:catalog-jdbc-postgresql", + "catalogs:catalog-jdbc-oceanbase" ) include("catalogs:catalog-hadoop") include("catalogs:catalog-kafka")