coolderli commented on code in PR #5818:
URL: https://github.com/apache/gravitino/pull/5818#discussion_r1881236578


##########
flink-connector/flink/src/main/java/org/apache/gravitino/flink/connector/store/GravitinoCatalogStore.java:
##########
@@ -106,6 +108,8 @@ private String getGravitinoCatalogProvider(Configuration 
configuration) {
     switch (catalogType) {
       case GravitinoHiveCatalogFactoryOptions.IDENTIFIER:
         return "hive";
+      case GravitinoPaimonCatalogFactoryOptions.IDENTIFIER:
+        return "paimon";

Review Comment:
   Shouldn't this be the `lakehouse-paimon`?



##########
flink-connector/flink/src/main/java/org/apache/gravitino/flink/connector/paimon/PaimonPropertiesConverter.java:
##########
@@ -0,0 +1,58 @@
+/*
+ * 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.flink.connector.paimon;
+
+import com.google.common.collect.Maps;
+import java.util.Map;
+import org.apache.flink.table.catalog.CommonCatalogOptions;
+import org.apache.gravitino.catalog.lakehouse.paimon.PaimonCatalogBackend;
+import org.apache.gravitino.catalog.lakehouse.paimon.PaimonConfig;
+import org.apache.gravitino.flink.connector.PropertiesConverter;
+import org.apache.paimon.options.CatalogOptions;
+
+public class PaimonPropertiesConverter implements PropertiesConverter {
+
+  public static final PaimonPropertiesConverter INSTANCE = new 
PaimonPropertiesConverter();
+
+  private PaimonPropertiesConverter() {}
+
+  @Override
+  public Map<String, String> toFlinkCatalogProperties(Map<String, String> 
gravitinoProperties) {
+    Map<String, String> flinkCatalogProperties = Maps.newHashMap();
+    flinkCatalogProperties.putAll(gravitinoProperties);
+    String backendType =
+        
flinkCatalogProperties.get(GravitinoPaimonCatalogFactoryOptions.backendType.key());
+    if (PaimonCatalogBackend.JDBC.name().equalsIgnoreCase(backendType)) {
+      flinkCatalogProperties.put(CatalogOptions.METASTORE.key(), backendType);
+      flinkCatalogProperties.put(
+          CatalogOptions.URI.key(), 
gravitinoProperties.get(PaimonConfig.CATALOG_URI.getKey()));
+      flinkCatalogProperties.put(
+          "jdbc.user", 
gravitinoProperties.get(PaimonConfig.CATALOG_JDBC_USER.getKey()));
+      flinkCatalogProperties.put(
+          "jdbc.password", 
gravitinoProperties.get(PaimonConfig.CATALOG_JDBC_PASSWORD.getKey()));
+    } else if (PaimonCatalogBackend.HIVE.name().equalsIgnoreCase(backendType)) 
{
+      throw new UnsupportedOperationException(

Review Comment:
   Why not support the Hive Catalog in Paimon?



##########
flink-connector/flink/src/test/java/org/apache/gravitino/flink/connector/integration/test/paimon/FlinkPaimonCatalogIT.java:
##########
@@ -0,0 +1,151 @@
+/*
+ * 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.flink.connector.integration.test.paimon;
+
+import com.google.common.base.Preconditions;
+import com.google.common.collect.ImmutableMap;
+import java.util.Arrays;
+import org.apache.flink.table.api.ResultKind;
+import org.apache.flink.table.api.TableResult;
+import org.apache.flink.types.Row;
+import org.apache.gravitino.Catalog;
+import org.apache.gravitino.Schema;
+import org.apache.gravitino.flink.connector.integration.test.FlinkEnvIT;
+import org.apache.gravitino.flink.connector.integration.test.utils.TestUtils;
+import 
org.apache.gravitino.flink.connector.paimon.GravitinoPaimonCatalogFactoryOptions;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+
+public class FlinkPaimonCatalogIT extends FlinkEnvIT {
+
+  private static final String DEFAULT_PAIMON_CATALOG =
+      "test_flink_paimon_filesystem_schema_catalog";
+
+  private static org.apache.gravitino.Catalog catalog;
+
+  protected Catalog currentCatalog() {
+    return catalog;
+  }
+
+  @BeforeAll
+  static void setup() {
+    initPaimonCatalog();
+  }
+
+  @AfterAll
+  static void stop() {
+    Preconditions.checkNotNull(metalake);
+    metalake.dropCatalog(DEFAULT_PAIMON_CATALOG, true);
+  }
+
+  private static void initPaimonCatalog() {
+    Preconditions.checkNotNull(metalake);
+    catalog =
+        metalake.createCatalog(
+            DEFAULT_PAIMON_CATALOG,
+            org.apache.gravitino.Catalog.Type.RELATIONAL,
+            "lakehouse-paimon",
+            null,
+            ImmutableMap.of(
+                GravitinoPaimonCatalogFactoryOptions.backendType.key(),
+                "filesystem",
+                "warehouse",
+                "/tmp/gravitino/paimon"));
+  }
+
+  @Test

Review Comment:
   Can you add a unit test that uses Flink SQL to create a catalog?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to