jerryshao commented on code in PR #9824:
URL: https://github.com/apache/gravitino/pull/9824#discussion_r2752408762


##########
core/src/main/java/org/apache/gravitino/storage/relational/mapper/provider/base/FunctionMetaBaseSQLProvider.java:
##########
@@ -0,0 +1,287 @@
+/*
+ * 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.storage.relational.mapper.provider.base;
+
+import static 
org.apache.gravitino.storage.relational.mapper.FunctionMetaMapper.TABLE_NAME;
+import static 
org.apache.gravitino.storage.relational.mapper.FunctionMetaMapper.VERSION_TABLE_NAME;
+
+import org.apache.gravitino.storage.relational.mapper.CatalogMetaMapper;
+import org.apache.gravitino.storage.relational.mapper.MetalakeMetaMapper;
+import org.apache.gravitino.storage.relational.mapper.SchemaMetaMapper;
+import org.apache.gravitino.storage.relational.po.FunctionPO;
+import org.apache.ibatis.annotations.Param;
+
+public class FunctionMetaBaseSQLProvider {
+
+  public String listFunctionPOsByFullQualifiedName(
+      @Param("metalakeName") String metalakeName,
+      @Param("catalogName") String catalogName,
+      @Param("schemaName") String schemaName) {
+    return """
+        SELECT
+            mm.metalake_id,
+            cm.catalog_id,
+            sm.schema_id,
+            fm.function_id,
+            fm.function_name,
+            fm.function_type,
+            fm.deterministic,
+            fm.return_type,
+            fm.function_current_version,
+            fm.function_latest_version,
+            fm.audit_info,
+            fm.deleted_at,
+            vi.id,
+            vi.metalake_id as version_metalake_id,
+            vi.catalog_id as version_catalog_id,
+            vi.schema_id as version_schema_id,
+            vi.function_id as version_function_id,
+            vi.version,
+            vi.function_comment,
+            vi.definitions,
+            vi.audit_info as version_audit_info,
+            vi.deleted_at as version_deleted_at
+        FROM
+            %s mm
+        INNER JOIN
+            %s cm ON mm.metalake_id = cm.metalake_id
+            AND cm.catalog_name = #{catalogName}
+            AND cm.deleted_at = 0
+        LEFT JOIN
+            %s sm ON cm.catalog_id = sm.catalog_id
+            AND sm.schema_name = #{schemaName}
+            AND sm.deleted_at = 0
+        LEFT JOIN
+            %s fm ON sm.schema_id = fm.schema_id
+            AND fm.deleted_at = 0
+        LEFT JOIN
+            %s vi ON fm.function_id = vi.function_id
+            AND fm.function_current_version = vi.version
+            AND vi.deleted_at = 0
+        WHERE
+            mm.metalake_name = #{metalakeName}
+            AND mm.deleted_at = 0
+        """
+        .formatted(
+            MetalakeMetaMapper.TABLE_NAME,
+            CatalogMetaMapper.TABLE_NAME,
+            SchemaMetaMapper.TABLE_NAME,
+            TABLE_NAME,
+            VERSION_TABLE_NAME);
+  }
+
+  public String insertFunctionMeta(@Param("functionMeta") FunctionPO 
functionPO) {
+    return "INSERT INTO "
+        + TABLE_NAME
+        + " (function_id, function_name, metalake_id, catalog_id, schema_id,"
+        + " function_type, `deterministic`, return_type, 
function_current_version,"
+        + " function_latest_version, audit_info, deleted_at)"
+        + " VALUES (#{functionMeta.functionId}, #{functionMeta.functionName},"
+        + " #{functionMeta.metalakeId}, #{functionMeta.catalogId}, 
#{functionMeta.schemaId},"
+        + " #{functionMeta.functionType}, #{functionMeta.deterministic},"
+        + " #{functionMeta.returnType}, 
#{functionMeta.functionCurrentVersion},"
+        + " #{functionMeta.functionLatestVersion}, #{functionMeta.auditInfo},"
+        + " #{functionMeta.deletedAt})";
+  }
+
+  public String insertFunctionMetaOnDuplicateKeyUpdate(
+      @Param("functionMeta") FunctionPO functionPO) {
+    return "INSERT INTO "
+        + TABLE_NAME
+        + " (function_id, function_name, metalake_id, catalog_id, schema_id,"
+        + " function_type, `deterministic`, return_type, 
function_current_version, function_latest_version, audit_info, deleted_at)"

Review Comment:
   Can you please also check this and other files? I guess here is also longer 
than 100 chars.



-- 
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