Skip to content

Commit

Permalink
feat: create view (#3807)
Browse files Browse the repository at this point in the history
* add statement

Signed-off-by: Ruihang Xia <[email protected]>

* feat: rebase with main

* fix: create flow

* feat: adds gRPC stuff

* feat: impl create_view ddl in operator

* feat: impl CreateViewProcedure

* chore: update cargo lock

* fix: format

* chore: compile error after rebasing main

* chore: refactor and test create view parser

* chore: fixed todo list and comments

* fix: compile error after rebeasing

* test: add create view test

* test: test view_info keys

* test: adds test for CreateViewProcedure and clean code

* test: adds more sqlness test for creating views

* chore: update cargo lock

* fix: don't replace normal table in CreateViewProcedure

* chore: apply suggestion

Co-authored-by: Jeremyhi <[email protected]>

* chore: style

Co-authored-by: Jeremyhi <[email protected]>

---------

Signed-off-by: Ruihang Xia <[email protected]>
Co-authored-by: Ruihang Xia <[email protected]>
Co-authored-by: Jeremyhi <[email protected]>
  • Loading branch information
3 people authored May 14, 2024
1 parent f16ce3c commit efd3f04
Show file tree
Hide file tree
Showing 36 changed files with 1,966 additions and 116 deletions.
104 changes: 52 additions & 52 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ etcd-client = { git = "https://github.com/MichaelScofield/etcd-client.git", rev
fst = "0.4.7"
futures = "0.3"
futures-util = "0.3"
greptime-proto = { git = "https://github.com/GreptimeTeam/greptime-proto.git", rev = "219b2409bb701f75b43fc0ba64967d2ed8e75491" }
greptime-proto = { git = "https://github.com/killme2008/greptime-proto.git", rev = "57e186d572c6c5898e90d6ab9e91b0867c30d1da" }
humantime = "2.1"
humantime-serde = "1.1"
itertools = "0.10"
Expand Down
2 changes: 2 additions & 0 deletions src/api/src/helper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,8 @@ fn ddl_request_type(request: &DdlRequest) -> &'static str {
Some(Expr::TruncateTable(_)) => "ddl.truncate_table",
Some(Expr::CreateFlow(_)) => "ddl.create_flow",
Some(Expr::DropFlow(_)) => "ddl.drop_flow",
Some(Expr::CreateView(_)) => "ddl.create_view",
Some(Expr::DropView(_)) => "ddl.drop_view",
None => "ddl.empty",
}
}
Expand Down
2 changes: 2 additions & 0 deletions src/common/meta/src/ddl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ pub mod create_flow;
pub mod create_logical_tables;
pub mod create_table;
mod create_table_template;
pub mod create_view;
pub mod drop_database;
pub mod drop_flow;
pub mod drop_table;
Expand Down Expand Up @@ -89,6 +90,7 @@ pub struct TableMetadataAllocatorContext {
}

/// Metadata allocated to a table.
#[derive(Default)]
pub struct TableMetadata {
/// Table id.
pub table_id: TableId,
Expand Down
2 changes: 1 addition & 1 deletion src/common/meta/src/ddl/create_logical_tables/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ impl CreateLogicalTablesProcedure {
} else {
self.context
.table_metadata_allocator
.allocate_table_id(task)
.allocate_table_id(&task.create_table.table_id)
.await?
};
task.set_table_id(table_id);
Expand Down
Loading

0 comments on commit efd3f04

Please sign in to comment.