minihippo commented on code in PR #5064:
URL: https://github.com/apache/hudi/pull/5064#discussion_r1037482859


##########
hudi-metaserver/src/main/resources/mybatis/DDLMapper.xml:
##########
@@ -0,0 +1,127 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd";>
+
+<mapper namespace="DDLMapper">
+    <update id="createDBs">
+        CREATE TABLE dbs
+        (
+            db_id BIGINT UNSIGNED PRIMARY KEY AUTO_INCREMENT COMMENT 'uuid',
+            desc VARCHAR(512) COMMENT 'database description',
+            location_uri VARCHAR(512) COMMENT 'database storage path',
+            name VARCHAR(512) UNIQUE COMMENT 'database name',
+            owner_name VARCHAR(512) COMMENT 'database owner',
+            owner_type VARCHAR(512) COMMENT 'database type',
+            create_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP COMMENT 'db 
created time',
+            update_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE 
CURRENT_TIMESTAMP COMMENT 'update time'
+        ) COMMENT 'databases';
+
+    </update>
+
+    <update id="createTables">
+        CREATE TABLE tbls
+        (
+            tbl_id BIGINT UNSIGNED PRIMARY KEY AUTO_INCREMENT COMMENT 'uuid',
+            db_id BIGINT COMMENT 'database id',
+            name VARCHAR(512) COMMENT 'table name',
+            create_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP COMMENT 'table 
created time',
+            update_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE 
CURRENT_TIMESTAMP COMMENT 'update time',
+            owner_name VARCHAR(512) COMMENT 'table owner',
+            location VARCHAR(512) COMMENT 'table location',
+            UNIQUE KEY uniq_tb (db_id, name)
+        ) COMMENT 'tables';
+    </update>
+
+    <update id="createTableParams">
+        CREATE TABLE tbl_params
+        (
+            tbl_id BIGINT UNSIGNED COMMENT 'tbl id',
+            param_key VARCHAR(256) COMMENT 'param_key',
+            param_value VARCHAR(2048) COMMENT 'param_value',
+            create_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP COMMENT 'parameter 
created time',
+            update_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE 
CURRENT_TIMESTAMP COMMENT 'update time',
+            PRIMARY KEY (tbl_id, param_key)
+        ) COMMENT 'tbl params';
+    </update>
+
+    <update id="createPartitions">
+        CREATE TABLE partitions
+        (
+            part_id BIGINT UNSIGNED PRIMARY KEY AUTO_INCREMENT COMMENT 'uuid',
+            tbl_id BIGINT COMMENT 'table id',
+            part_name VARCHAR(256) COMMENT 'partition path',
+            create_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP COMMENT 'create 
time',
+            update_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE 
CURRENT_TIMESTAMP  COMMENT 'update time',
+            is_deleted BOOL DEFAULT FALSE COMMENT 'whether the partition is 
deleted',
+            UNIQUE uniq_partition_version (tbl_id, part_name)
+        ) COMMENT 'partitions';
+    </update>
+
+    <update id="createTableTimestamp">
+        CREATE TABLE tbl_timestamp
+        (
+            tbl_id BIGINT UNSIGNED PRIMARY KEY COMMENT 'uuid',
+            ts VARCHAR(17) COMMENT 'instant timestamp'
+        ) COMMENT 'generate the unique timestamp for a table';
+    </update>
+
+    <update id="createInstant">
+        CREATE TABLE instant
+        (
+            instant_id BIGINT UNSIGNED PRIMARY KEY AUTO_INCREMENT COMMENT 
'uuid',
+            tbl_id BIGINT COMMENT 'table id',
+            ts  VARCHAR(17) COMMENT 'instant timestamp',
+            action TINYINT COMMENT 'commit, deltacommit, compaction, replace 
etc',
+            state    TINYINT COMMENT 'completed, requested, inflight, invalid 
etc',
+            duration INT  DEFAULT 0 COMMENT 'for heartbeat (s)',
+            start_ts INT  DEFAULT 0 COMMENT 'for heartbeat (s)',
+            UNIQUE KEY uniq_inst1 (tbl_id, state, ts, action),
+            UNIQUE KEY uniq_inst2 (tbl_id, ts)
+        ) COMMENT 'timeline';
+    </update>
+
+    <update id="createInstantMeta">
+        CREATE TABLE instant_meta
+        (
+            commit_id BIGINT UNSIGNED PRIMARY KEY AUTO_INCREMENT COMMENT 
'uuid',
+            tbl_id BIGINT COMMENT 'table id',
+            ts VARCHAR(17) COMMENT 'instant timestamp',
+            action TINYINT COMMENT 'commit, deltacommit, compaction, replace 
etc',
+            state TINYINT COMMENT 'completed, requested, inflight, invalid 
etc',
+            data LONGBLOB COMMENT 'instant metadate',

Review Comment:
   fix



##########
hudi-metaserver/src/main/resources/mybatis/DDLMapper.xml:
##########
@@ -0,0 +1,127 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd";>
+
+<mapper namespace="DDLMapper">
+    <update id="createDBs">
+        CREATE TABLE dbs
+        (
+            db_id BIGINT UNSIGNED PRIMARY KEY AUTO_INCREMENT COMMENT 'uuid',
+            desc VARCHAR(512) COMMENT 'database description',
+            location_uri VARCHAR(512) COMMENT 'database storage path',
+            name VARCHAR(512) UNIQUE COMMENT 'database name',
+            owner_name VARCHAR(512) COMMENT 'database owner',
+            owner_type VARCHAR(512) COMMENT 'database type',
+            create_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP COMMENT 'db 
created time',
+            update_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE 
CURRENT_TIMESTAMP COMMENT 'update time'
+        ) COMMENT 'databases';
+
+    </update>
+
+    <update id="createTables">
+        CREATE TABLE tbls
+        (
+            tbl_id BIGINT UNSIGNED PRIMARY KEY AUTO_INCREMENT COMMENT 'uuid',
+            db_id BIGINT COMMENT 'database id',
+            name VARCHAR(512) COMMENT 'table name',
+            create_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP COMMENT 'table 
created time',
+            update_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE 
CURRENT_TIMESTAMP COMMENT 'update time',
+            owner_name VARCHAR(512) COMMENT 'table owner',
+            location VARCHAR(512) COMMENT 'table location',
+            UNIQUE KEY uniq_tb (db_id, name)
+        ) COMMENT 'tables';
+    </update>
+
+    <update id="createTableParams">
+        CREATE TABLE tbl_params
+        (
+            tbl_id BIGINT UNSIGNED COMMENT 'tbl id',
+            param_key VARCHAR(256) COMMENT 'param_key',
+            param_value VARCHAR(2048) COMMENT 'param_value',
+            create_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP COMMENT 'parameter 
created time',
+            update_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE 
CURRENT_TIMESTAMP COMMENT 'update time',
+            PRIMARY KEY (tbl_id, param_key)
+        ) COMMENT 'tbl params';
+    </update>
+
+    <update id="createPartitions">
+        CREATE TABLE partitions
+        (
+            part_id BIGINT UNSIGNED PRIMARY KEY AUTO_INCREMENT COMMENT 'uuid',
+            tbl_id BIGINT COMMENT 'table id',
+            part_name VARCHAR(256) COMMENT 'partition path',
+            create_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP COMMENT 'create 
time',
+            update_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE 
CURRENT_TIMESTAMP  COMMENT 'update time',
+            is_deleted BOOL DEFAULT FALSE COMMENT 'whether the partition is 
deleted',
+            UNIQUE uniq_partition_version (tbl_id, part_name)
+        ) COMMENT 'partitions';
+    </update>
+
+    <update id="createTableTimestamp">
+        CREATE TABLE tbl_timestamp
+        (
+            tbl_id BIGINT UNSIGNED PRIMARY KEY COMMENT 'uuid',
+            ts VARCHAR(17) COMMENT 'instant timestamp'
+        ) COMMENT 'generate the unique timestamp for a table';
+    </update>
+
+    <update id="createInstant">
+        CREATE TABLE instant
+        (
+            instant_id BIGINT UNSIGNED PRIMARY KEY AUTO_INCREMENT COMMENT 
'uuid',
+            tbl_id BIGINT COMMENT 'table id',
+            ts  VARCHAR(17) COMMENT 'instant timestamp',
+            action TINYINT COMMENT 'commit, deltacommit, compaction, replace 
etc',
+            state    TINYINT COMMENT 'completed, requested, inflight, invalid 
etc',
+            duration INT  DEFAULT 0 COMMENT 'for heartbeat (s)',
+            start_ts INT  DEFAULT 0 COMMENT 'for heartbeat (s)',
+            UNIQUE KEY uniq_inst1 (tbl_id, state, ts, action),
+            UNIQUE KEY uniq_inst2 (tbl_id, ts)
+        ) COMMENT 'timeline';
+    </update>
+
+    <update id="createInstantMeta">
+        CREATE TABLE instant_meta
+        (
+            commit_id BIGINT UNSIGNED PRIMARY KEY AUTO_INCREMENT COMMENT 
'uuid',
+            tbl_id BIGINT COMMENT 'table id',
+            ts VARCHAR(17) COMMENT 'instant timestamp',
+            action TINYINT COMMENT 'commit, deltacommit, compaction, replace 
etc',
+            state TINYINT COMMENT 'completed, requested, inflight, invalid 
etc',
+            data LONGBLOB COMMENT 'instant metadate',
+            create_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP COMMENT 'instant 
meta created time',
+            UNIQUE KEY uniq_inst3 (tbl_id, state, ts, action)
+        ) COMMENT 'instant meta';
+    </update>
+
+    <update id="createFiles">
+        CREATE TABLE files
+        (
+            id          BIGINT UNSIGNED PRIMARY KEY AUTO_INCREMENT COMMENT 
'uuid',
+            tbl_id      BIGINT COMMENT 'table id',
+            part_id     BIGINT COMMENT 'partition id',
+            name        VARCHAR(256) COMMENT 'file name',
+            size        BIGINT COMMENT 'file size',
+            is_deleted  BOOL COMMENT 'whether the file has been deleted',
+            create_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP COMMENT 'create 
time',
+            update_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE 
CURRENT_TIMESTAMP COMMENT 'update time',
+            UNIQUE KEY uniq_name (part_id, name)
+        ) COMMENT 'snapshot 文件表';

Review Comment:
   fix



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