World's most powerful open data catalog for building a high-performance, geo-distributed and federated metadata lake.
Java ai-catalogdata-catalogdatalakefederated-querylakehousemetadatametalakemodel-catalogopendatacatalogskycomputingstratosphere
[#7667] feat(starrocks-catalog): Add StarRocks catalog skeleton. (#7671)
Mini Yu70b40c452f42
diff --git a/build.gradle.kts b/build.gradle.ktsindex 4adda3e60c..6f3a334b93 100644--- a/build.gradle.kts+++ b/build.gradle.kts@@ -869,6 +869,7 @@ tasks {":catalogs:catalog-jdbc-mysql:copyLibAndConfig",":catalogs:catalog-jdbc-oceanbase:copyLibAndConfig",":catalogs:catalog-jdbc-postgresql:copyLibAndConfig",+ ":catalogs:catalog-jdbc-starrocks:copyLibAndConfig",":catalogs:catalog-kafka:copyLibAndConfig",":catalogs:catalog-lakehouse-hudi:copyLibAndConfig",":catalogs:catalog-lakehouse-iceberg:copyLibAndConfig",diff --git a/catalogs/catalog-jdbc-starrocks/build.gradle.kts b/catalogs/catalog-jdbc-starrocks/build.gradle.ktsnew file mode 100644index 0000000000..e6a31d73d3--- /dev/null+++ b/catalogs/catalog-jdbc-starrocks/build.gradle.kts@@ -0,0 +1,107 @@+/*+ * 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-starrocks"++plugins {+ `maven-publish`+ id("java")+ id("idea")+}++dependencies {+ implementation(project(":api")) {+ 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)++ 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.mysql.driver)+ testImplementation(libs.postgresql.driver)+ testImplementation(libs.testcontainers)+ testImplementation(libs.testcontainers.mysql)++ testRuntimeOnly(libs.junit.jupiter.engine)+}++tasks {+ val runtimeJars by registering(Copy::class) {+ from(configurations.runtimeClasspath)+ into("build/libs")+ }+ 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/jdbc-starrocks/libs")+ }++ val copyCatalogConfig by registering(Copy::class) {+ from("src/main/resources")+ into("$rootDir/distribution/package/catalogs/jdbc-starrocks/conf")++ include("jdbc-starrocks.conf")++ 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")+}diff --git a/catalogs/catalog-jdbc-starrocks/src/main/java/org/apache/gravitino/catalog/starrocks/StarRocksCatalog.java b/catalogs/catalog-jdbc-starrocks/src/main/java/org/apache/gravitino/catalog/starrocks/StarRocksCatalog.javanew file mode 100644index 0000000000..9383169632--- /dev/null+++ b/catalogs/catalog-jdbc-starrocks/src/main/java/org/apache/gravitino/catalog/starrocks/StarRocksCatalog.java@@ -0,0 +1,93 @@+/*+ * 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.starrocks;++import java.util.Map;+import org.apache.gravitino.catalog.jdbc.JdbcCatalog;+import org.apache.gravitino.catalog.jdbc.MySQLProtocolCompatibleCatalogOperations;+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.starrocks.converter.StarRocksColumnDefaultValueConverter;+import org.apache.gravitino.catalog.starrocks.converter.StarRocksExceptionConverter;+import org.apache.gravitino.catalog.starrocks.converter.StarRocksTypeConverter;+import org.apache.gravitino.catalog.starrocks.operations.StarRocksDatabaseOperations;+import org.apache.gravitino.catalog.starrocks.operations.StarRocksTableOperations;+import org.apache.gravitino.connector.CatalogOperations;+import org.apache.gravitino.connector.PropertiesMetadata;+import org.apache.gravitino.connector.capability.Capability;++public class StarRocksCatalog extends JdbcCatalog {+ public static final StarRocksTablePropertiesMeta STARROCKS_TABLE_PROPERTIES_META =+ new StarRocksTablePropertiesMeta();++ @Override+ public String shortName() {+ return "jdbc-starrocks";+ }++ @Override+ protected CatalogOperations newOps(Map<String, String> config) {+ JdbcTypeConverter jdbcTypeConverter = createJdbcTypeConverter();+ return new MySQLProtocolCompatibleCatalogOperations(+ createExceptionConverter(),+ jdbcTypeConverter,+ createJdbcDatabaseOperations(),+ createJdbcTableOperations(),+ createJdbcColumnDefaultValueConverter());+ }++ @Override+ public Capability newCapability() {+ return new StarRocksCatalogCapability();+ }++ @Override+ protected JdbcExceptionConverter createExceptionConverter() {+ return new StarRocksExceptionConverter();+ }++ @Override+ protected JdbcTypeConverter createJdbcTypeConverter() {+ return new StarRocksTypeConverter();+ }++ @Override+ protected JdbcDatabaseOperations createJdbcDatabaseOperations() {+ return new StarRocksDatabaseOperations();+ }++ @Override+ protected JdbcTableOperations createJdbcTableOperations() {+ return new StarRocksTableOperations();+ }++ @Override+ protected JdbcColumnDefaultValueConverter createJdbcColumnDefaultValueConverter() {+ return new StarRocksColumnDefaultValueConverter();+ }++ @Override+ public PropertiesMetadata tablePropertiesMetadata() throws UnsupportedOperationException {+ return STARROCKS_TABLE_PROPERTIES_META;+ }+}diff --git a/catalogs/catalog-jdbc-starrocks/src/main/java/org/apache/gravitino/catalog/starrocks/StarRocksCatalogCapability.java b/catalogs/catalog-jdbc-starrocks/src/main/java/org/apache/gravitino/catalog/starrocks/StarRocksCatalogCapability.javanew file mode 100644index 0000000000..6d1fb72f82--- /dev/null+++ b/catalogs/catalog-jdbc-starrocks/src/main/java/org/apache/gravitino/catalog/starrocks/StarRocksCatalogCapability.java@@ -0,0 +1,27 @@+/*+ * 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.starrocks;++import org.apache.gravitino.connector.capability.Capability;++public class StarRocksCatalogCapability implements Capability {+ // StarRocks best practice mention that the name should be in lowercase, separated by underscores+ // We can use the more general DEFAULT_NAME_PATTERN for StarRocks and update as needed in the+ // future+}diff --git a/catalogs/catalog-jdbc-starrocks/src/main/java/org/apache/gravitino/catalog/starrocks/StarRocksTablePropertiesMeta.java b/catalogs/catalog-jdbc-starrocks/src/main/java/org/apache/gravitino/catalog/starrocks/StarRocksTablePropertiesMeta.javanew file mode 100644index 0000000000..6950e4edab--- /dev/null+++ b/catalogs/catalog-jdbc-starrocks/src/main/java/org/apache/gravitino/catalog/starrocks/StarRocksTablePropertiesMeta.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.starrocks;++import com.google.common.collect.ImmutableMap;+import java.util.Map;+import org.apache.gravitino.catalog.jdbc.JdbcTablePropertiesMetadata;+import org.apache.gravitino.connector.PropertyEntry;++public class StarRocksTablePropertiesMeta extends JdbcTablePropertiesMetadata {++ @Override+ protected Map<String, PropertyEntry<?>> specificPropertyEntries() {+ return ImmutableMap.of();+ }+}diff --git a/catalogs/catalog-jdbc-starrocks/src/main/java/org/apache/gravitino/catalog/starrocks/converter/StarRocksColumnDefaultValueConverter.java b/catalogs/catalog-jdbc-starrocks/src/main/java/org/apache/gravitino/catalog/starrocks/converter/StarRocksColumnDefaultValueConverter.javanew file mode 100644index 0000000000..a1026e0e44--- /dev/null+++ b/catalogs/catalog-jdbc-starrocks/src/main/java/org/apache/gravitino/catalog/starrocks/converter/StarRocksColumnDefaultValueConverter.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.starrocks.converter;++import org.apache.commons.lang3.NotImplementedException;+import org.apache.gravitino.catalog.jdbc.converter.JdbcColumnDefaultValueConverter;+import org.apache.gravitino.catalog.jdbc.converter.JdbcTypeConverter;+import org.apache.gravitino.rel.expressions.Expression;++public class StarRocksColumnDefaultValueConverter extends JdbcColumnDefaultValueConverter {++ @Override+ public Expression toGravitino(+ JdbcTypeConverter.JdbcTypeBean columnType,+ String columnDefaultValue,+ boolean isExpression,+ boolean nullable) {+ throw new NotImplementedException("To be implemented in the future");+ }+}diff --git a/catalogs/catalog-jdbc-starrocks/src/main/java/org/apache/gravitino/catalog/starrocks/converter/StarRocksExceptionConverter.java b/catalogs/catalog-jdbc-starrocks/src/main/java/org/apache/gravitino/catalog/starrocks/converter/StarRocksExceptionConverter.javanew file mode 100644index 0000000000..c5fe992532--- /dev/null+++ b/catalogs/catalog-jdbc-starrocks/src/main/java/org/apache/gravitino/catalog/starrocks/converter/StarRocksExceptionConverter.java@@ -0,0 +1,34 @@+/*+ * 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.starrocks.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 StarRocks. */+public class StarRocksExceptionConverter extends JdbcExceptionConverter {++ @SuppressWarnings("FormatStringAnnotation")+ @Override+ public GravitinoRuntimeException toGravitinoException(SQLException se) {+ throw new GravitinoRuntimeException(+ String.format("StarRocks exception: %s", se.getMessage()), se);+ }+}diff --git a/catalogs/catalog-jdbc-starrocks/src/main/java/org/apache/gravitino/catalog/starrocks/converter/StarRocksTypeConverter.java b/catalogs/catalog-jdbc-starrocks/src/main/java/org/apache/gravitino/catalog/starrocks/converter/StarRocksTypeConverter.javanew file mode 100644index 0000000000..781394348c--- /dev/null+++ b/catalogs/catalog-jdbc-starrocks/src/main/java/org/apache/gravitino/catalog/starrocks/converter/StarRocksTypeConverter.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.starrocks.converter;++import org.apache.commons.lang3.NotImplementedException;+import org.apache.gravitino.catalog.jdbc.converter.JdbcTypeConverter;+import org.apache.gravitino.rel.types.Type;++/** Type converter for StarRocks. */+public class StarRocksTypeConverter extends JdbcTypeConverter {+ @Override+ public Type toGravitino(JdbcTypeBean typeBean) {+ throw new NotImplementedException("To be implemented in the future");+ }++ @Override+ public String fromGravitino(Type type) {+ throw new NotImplementedException("To be implemented in the future");+ }+}diff --git a/catalogs/catalog-jdbc-starrocks/src/main/java/org/apache/gravitino/catalog/starrocks/operations/StarRocksDatabaseOperations.java b/catalogs/catalog-jdbc-starrocks/src/main/java/org/apache/gravitino/catalog/starrocks/operations/StarRocksDatabaseOperations.javanew file mode 100644index 0000000000..85607ed33c--- /dev/null+++ b/catalogs/catalog-jdbc-starrocks/src/main/java/org/apache/gravitino/catalog/starrocks/operations/StarRocksDatabaseOperations.java@@ -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.gravitino.catalog.starrocks.operations;++import com.google.common.collect.ImmutableSet;+import java.util.Map;+import java.util.Set;+import org.apache.commons.lang3.NotImplementedException;+import org.apache.gravitino.catalog.jdbc.JdbcSchema;+import org.apache.gravitino.catalog.jdbc.operation.JdbcDatabaseOperations;+import org.apache.gravitino.exceptions.NoSuchSchemaException;++/** Database operations for StarRocks. */+public class StarRocksDatabaseOperations extends JdbcDatabaseOperations {+ @Override+ public String generateCreateDatabaseSql(+ String databaseName, String comment, Map<String, String> properties) {+ throw new NotImplementedException("To be implemented in the future");+ }++ @Override+ public String generateDropDatabaseSql(String databaseName, boolean cascade) {+ throw new NotImplementedException("To be implemented in the future");+ }++ @Override+ public JdbcSchema load(String databaseName) throws NoSuchSchemaException {+ throw new NotImplementedException("To be implemented in the future");+ }++ @Override+ protected boolean supportSchemaComment() {+ return true;+ }++ @Override+ protected Set<String> createSysDatabaseNameSet() {+ return ImmutableSet.of("information_schema");+ }+}diff --git a/catalogs/catalog-jdbc-starrocks/src/main/java/org/apache/gravitino/catalog/starrocks/operations/StarRocksTableOperations.java b/catalogs/catalog-jdbc-starrocks/src/main/java/org/apache/gravitino/catalog/starrocks/operations/StarRocksTableOperations.javanew file mode 100644index 0000000000..11ae78b758--- /dev/null+++ b/catalogs/catalog-jdbc-starrocks/src/main/java/org/apache/gravitino/catalog/starrocks/operations/StarRocksTableOperations.java@@ -0,0 +1,109 @@+/*+ * 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.starrocks.operations;++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.NotImplementedException;+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.catalog.jdbc.operation.JdbcTablePartitionOperations;+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 StarRocks. */+public class StarRocksTableOperations extends JdbcTableOperations {++ @Override+ public JdbcTablePartitionOperations createJdbcTablePartitionOperations(JdbcTable loadedTable) {+ return new StarRocksTablePartitionOperations(+ dataSource, loadedTable, exceptionMapper, typeConverter);+ }++ @Override+ protected String generateCreateTableSql(+ String tableName,+ JdbcColumn[] columns,+ String comment,+ Map<String, String> properties,+ Transform[] partitioning,+ Distribution distribution,+ Index[] indexes) {+ throw new NotImplementedException("To be implemented in the future");+ }++ @Override+ protected boolean getAutoIncrementInfo(ResultSet resultSet) throws SQLException {+ throw new NotImplementedException("To be implemented in the future");+ }++ @Override+ protected Map<String, String> getTableProperties(Connection connection, String tableName)+ throws SQLException {+ throw new NotImplementedException("To be implemented in the future");+ }++ @Override+ protected List<Index> getIndexes(Connection connection, String databaseName, String tableName)+ throws SQLException {+ throw new NotImplementedException("To be implemented in the future");+ }++ @Override+ protected Transform[] getTablePartitioning(+ Connection connection, String databaseName, String tableName) throws SQLException {+ throw new NotImplementedException("To be implemented in the future");+ }++ @Override+ protected void correctJdbcTableFields(+ Connection connection, String databaseName, String tableName, JdbcTable.Builder tableBuilder)+ throws SQLException {+ throw new NotImplementedException("To be implemented in the future");+ }++ @Override+ protected String generateRenameTableSql(String oldTableName, String newTableName) {+ throw new NotImplementedException("To be implemented in the future");+ }++ @Override+ protected String generatePurgeTableSql(String tableName) {+ throw new UnsupportedOperationException(+ "StarRocks does not support purge table in Gravitino, please use drop table");+ }++ @Override+ protected String generateAlterTableSql(+ String databaseName, String tableName, TableChange... changes) {+ throw new NotImplementedException("To be implemented in the future");+ }++ @Override+ protected Distribution getDistributionInfo(+ Connection connection, String databaseName, String tableName) throws SQLException {+ throw new NotImplementedException("To be implemented in the future");+ }+}diff --git a/catalogs/catalog-jdbc-starrocks/src/main/java/org/apache/gravitino/catalog/starrocks/operations/StarRocksTablePartitionOperations.java b/catalogs/catalog-jdbc-starrocks/src/main/java/org/apache/gravitino/catalog/starrocks/operations/StarRocksTablePartitionOperations.javanew file mode 100644index 0000000000..97d038b547--- /dev/null+++ b/catalogs/catalog-jdbc-starrocks/src/main/java/org/apache/gravitino/catalog/starrocks/operations/StarRocksTablePartitionOperations.java@@ -0,0 +1,78 @@+/*+ * 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.starrocks.operations;++import static com.google.common.base.Preconditions.checkArgument;++import javax.sql.DataSource;+import org.apache.commons.lang3.NotImplementedException;+import org.apache.gravitino.catalog.jdbc.JdbcTable;+import org.apache.gravitino.catalog.jdbc.converter.JdbcExceptionConverter;+import org.apache.gravitino.catalog.jdbc.converter.JdbcTypeConverter;+import org.apache.gravitino.catalog.jdbc.operation.JdbcTablePartitionOperations;+import org.apache.gravitino.exceptions.NoSuchPartitionException;+import org.apache.gravitino.exceptions.PartitionAlreadyExistsException;+import org.apache.gravitino.rel.partitions.Partition;++/** Table partition operations for StarRocks. */+public final class StarRocksTablePartitionOperations extends JdbcTablePartitionOperations {++ @SuppressWarnings("unused")+ private final JdbcExceptionConverter exceptionConverter;++ @SuppressWarnings("unused")+ private final JdbcTypeConverter typeConverter;++ public StarRocksTablePartitionOperations(+ DataSource dataSource,+ JdbcTable loadedTable,+ JdbcExceptionConverter exceptionConverter,+ JdbcTypeConverter typeConverter) {+ super(dataSource, loadedTable);+ checkArgument(exceptionConverter != null, "exceptionConverter is null");+ checkArgument(typeConverter != null, "typeConverter is null");+ this.exceptionConverter = exceptionConverter;+ this.typeConverter = typeConverter;+ }++ @Override+ public String[] listPartitionNames() {+ throw new NotImplementedException("To be implemented in the future");+ }++ @Override+ public Partition[] listPartitions() {+ throw new NotImplementedException("To be implemented in the future");+ }++ @Override+ public Partition getPartition(String partitionName) throws NoSuchPartitionException {+ throw new NotImplementedException("To be implemented in the future");+ }++ @Override+ public Partition addPartition(Partition partition) throws PartitionAlreadyExistsException {+ throw new NotImplementedException("To be implemented in the future");+ }++ @Override+ public boolean dropPartition(String partitionName) {+ throw new NotImplementedException("To be implemented in the future");+ }+}diff --git a/catalogs/catalog-jdbc-starrocks/src/main/resources/META-INF/services/org.apache.gravitino.CatalogProvider b/catalogs/catalog-jdbc-starrocks/src/main/resources/META-INF/services/org.apache.gravitino.CatalogProvidernew file mode 100644index 0000000000..c86ebe2c9e--- /dev/null+++ b/catalogs/catalog-jdbc-starrocks/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.starrocks.StarRocksCatalog\ No newline at end of filediff --git a/catalogs/catalog-jdbc-starrocks/src/main/resources/jdbc-starrocks.conf b/catalogs/catalog-jdbc-starrocks/src/main/resources/jdbc-starrocks.confnew file mode 100644index 0000000000..7e00d97dda--- /dev/null+++ b/catalogs/catalog-jdbc-starrocks/src/main/resources/jdbc-starrocks.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:9030/+# jdbc-user = starrocks+# jdbc-password = starrocks+# jdbc-driver = com.mysql.jdbc.Driver\ No newline at end of filediff --git a/settings.gradle.kts b/settings.gradle.ktsindex 0b6939f28e..6b8b3fcd06 100644--- a/settings.gradle.kts+++ b/settings.gradle.kts@@ -37,7 +37,8 @@ include("catalogs:catalog-jdbc-doris","catalogs:catalog-jdbc-mysql","catalogs:catalog-jdbc-postgresql",- "catalogs:catalog-jdbc-oceanbase"+ "catalogs:catalog-jdbc-oceanbase",+ "catalogs:catalog-jdbc-starrocks")include("catalogs:catalog-fileset")include("catalogs:catalog-kafka")