Skip to content

feat: create table procedure for metric engine, part 1#2943

Merged
MichaelScofield merged 4 commits intoGreptimeTeam:developfrom
waynexia:create-metric-region
Dec 18, 2023
Merged

feat: create table procedure for metric engine, part 1#2943
MichaelScofield merged 4 commits intoGreptimeTeam:developfrom
waynexia:create-metric-region

Conversation

@waynexia
Copy link
Copy Markdown
Member

I hereby agree to the terms of the GreptimeDB CLA

What's changed and what's your intention?

Implement procedure for creating a metric table.

This patch doesn't contains the logic related to route table etc.

Demo:

MySQL [(none)]> create table phy(
    ->   ts timestamp time index,
    ->   a string primary key,
    -> ) engine = metric with (
    ->   'physical_metric_table'=''
    -> );
Query OK, 0 rows affected (0.002 sec)

MySQL [(none)]> select * from information_schema.tables where engine = 'metric';
+---------------+--------------+------------+------------+----------+--------+
| table_catalog | table_schema | table_name | table_type | table_id | engine |
+---------------+--------------+------------+------------+----------+--------+
| greptime      | public       | phy        | BASE TABLE |     1025 | metric |
+---------------+--------------+------------+------------+----------+--------+
1 row in set (0.002 sec)

MySQL [(none)]> create table log(
    ->   ts timestamp time index,
    ->   a string primary key,
    -> ) engine = metric with (
    ->   'on_physical_table' = 'phy'
    -> );
Query OK, 0 rows affected (0.002 sec)

MySQL [(none)]> select * from information_schema.tables where engine = 'metric';
+---------------+--------------+------------+------------+----------+--------+
| table_catalog | table_schema | table_name | table_type | table_id | engine |
+---------------+--------------+------------+------------+----------+--------+
| greptime      | public       | log        | BASE TABLE |     1026 | metric |
| greptime      | public       | phy        | BASE TABLE |     1025 | metric |
+---------------+--------------+------------+------------+----------+--------+
2 rows in set (0.002 sec)

Checklist

  • I have written the necessary rustdoc comments.
  • I have added the necessary unit tests and integration tests.

Refer to a related PR or issue link (optional)

ref to #2070

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>
Signed-off-by: Ruihang Xia <waynestxia@gmail.com>
@codecov
Copy link
Copy Markdown

codecov Bot commented Dec 15, 2023

Codecov Report

Merging #2943 (8bb4108) into develop (5dba373) will decrease coverage by 0.52%.
Report is 4 commits behind head on develop.
The diff coverage is 59.30%.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #2943      +/-   ##
===========================================
- Coverage    85.05%   84.53%   -0.52%     
===========================================
  Files          754      756       +2     
  Lines       119742   120106     +364     
===========================================
- Hits        101844   101531     -313     
- Misses       17898    18575     +677     

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>
Copy link
Copy Markdown
Member

@WenyXu WenyXu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add some tests after the logic table route is available.

@waynexia waynexia self-assigned this Dec 18, 2023
@waynexia
Copy link
Copy Markdown
Member Author

Let's add some tests after the logic table route is available.

👍 Add an item to project Metric Engine (view)

Comment thread src/common/meta/src/ddl/create_table.rs Outdated
Comment thread src/common/meta/src/ddl/create_table.rs Outdated
Signed-off-by: Ruihang Xia <waynestxia@gmail.com>
@MichaelScofield MichaelScofield added this pull request to the merge queue Dec 18, 2023
Merged via the queue into GreptimeTeam:develop with commit 9af9c02 Dec 18, 2023
@waynexia waynexia deleted the create-metric-region branch December 18, 2023 08:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: ✅ Done

Development

Successfully merging this pull request may close these issues.

4 participants