From 82d5ca43fd4899aad4df34392f95225aa47a5351 Mon Sep 17 00:00:00 2001 From: QuintinTao Date: Fri, 21 Oct 2022 16:36:36 +0800 Subject: [PATCH 01/28] Show tables statement support like syntax --- interpreters/src/show.rs | 32 +++++++++++++++++++++----------- sql/src/ast.rs | 8 +++++++- sql/src/parser.rs | 20 ++++++++++++++++++-- sql/src/plan.rs | 8 +++++++- sql/src/planner.rs | 14 +++++++++----- 5 files changed, 62 insertions(+), 20 deletions(-) diff --git a/interpreters/src/show.rs b/interpreters/src/show.rs index 2eca0520ab..8a57860f17 100644 --- a/interpreters/src/show.rs +++ b/interpreters/src/show.rs @@ -14,6 +14,7 @@ use sql::{ ast::ShowCreateObject, plan::{ShowCreatePlan, ShowPlan}, }; +use sql::plan::ShowTablesPlan; use crate::{ context::Context, @@ -94,16 +95,25 @@ impl ShowInterpreter { show_create.execute_show_create() } - fn show_tables(ctx: Context, catalog_manager: ManagerRef) -> Result { + fn show_tables(ctx: Context, catalog_manager: ManagerRef,plan: ShowTablesPlan) -> Result { let schema = get_default_schema(&ctx, &catalog_manager)?; - let tables_names = schema - .all_tables() - .context(FetchTables)? - .iter() - .map(|t| t.name().to_string()) - .collect::>(); - + let tables_names = match plan.if_fuzzy { + true => schema + .all_tables() + .context(FetchTables)? + .iter() + .filter(|t| t.name().contains(plan.fuzzy_target.as_ref().unwrap().as_ref())) + .map(|t| t.name().to_string()) + .collect::>(), + false => + schema + .all_tables() + .context(FetchTables)? + .iter() + .map(|t| t.name().to_string()) + .collect::>(), + }; let schema = DataSchema::new(vec![Field::new( SHOW_TABLES_COLUMN_SCHEMA, DataType::Utf8, @@ -113,7 +123,7 @@ impl ShowInterpreter { Arc::new(schema), vec![Arc::new(StringArray::from(tables_names))], ) - .context(CreateRecordBatch)?; + .context(CreateRecordBatch)?; let record_batch = record_batch.try_into().context(ToCommonRecordType)?; @@ -151,8 +161,8 @@ impl Interpreter for ShowInterpreter { async fn execute(self: Box) -> InterpreterResult { match self.plan { ShowPlan::ShowCreatePlan(t) => Self::show_create(t).context(ShowCreateTable), - ShowPlan::ShowTables => { - Self::show_tables(self.ctx, self.catalog_manager).context(ShowTables) + ShowPlan::ShowTablesPlan(t) => { + Self::show_tables(self.ctx, self.catalog_manager, t).context(ShowTables) } ShowPlan::ShowDatabase => { Self::show_databases(self.ctx, self.catalog_manager).context(ShowDatabases) diff --git a/sql/src/ast.rs b/sql/src/ast.rs index 304a8d1ef5..15c102714a 100644 --- a/sql/src/ast.rs +++ b/sql/src/ast.rs @@ -22,7 +22,7 @@ pub enum Statement { /// SHOW CREATE TABLE ShowCreate(ShowCreate), ShowDatabases, - ShowTables, + ShowTables(ShowTables), Exists(ExistsTable), } @@ -96,6 +96,12 @@ pub struct AlterAddColumn { pub columns: Vec, } +#[derive(Debug, PartialEq, Eq)] +pub struct ShowTables { + pub if_fuzzy: bool, + pub fuzzy_target: Option, +} + #[derive(Debug, PartialEq, Eq)] pub struct ShowCreate { pub obj_type: ShowCreateObject, diff --git a/sql/src/parser.rs b/sql/src/parser.rs index c964bbe935..779781c155 100644 --- a/sql/src/parser.rs +++ b/sql/src/parser.rs @@ -16,7 +16,7 @@ use table_engine::ANALYTIC_ENGINE_TYPE; use crate::ast::{ AlterAddColumn, AlterModifySetting, CreateTable, DescribeTable, DropTable, ExistsTable, - ShowCreate, ShowCreateObject, Statement, + ShowCreate, ShowCreateObject, Statement, ShowTables, }; define_result!(ParserError); @@ -223,7 +223,7 @@ impl<'a> Parser<'a> { pub fn parse_show(&mut self) -> Result { if self.consume_token("TABLES") { - Ok(Statement::ShowTables) + Ok(self.parse_show_tables()?) } else if self.consume_token("DATABASES") { Ok(Statement::ShowDatabases) } else if self.consume_token("CREATE") { @@ -233,6 +233,22 @@ impl<'a> Parser<'a> { } } + fn parse_show_tables(&mut self) -> Result { + let (if_fuzzy, fuzzy_target)= match self.parser.next_token() { + Token::Word(w) => + match w.keyword { + Keyword::LIKE => (true, Some(self.parser.next_token().to_string())), + _ => (false, None) + }, + + _ => (false, None), + }; + Ok(Statement::ShowTables(ShowTables{ + if_fuzzy, + fuzzy_target, + })) + } + fn parse_show_create(&mut self) -> Result { let obj_type = match self.parser.expect_one_of_keywords(&[Keyword::TABLE])? { Keyword::TABLE => Ok(ShowCreateObject::Table), diff --git a/sql/src/plan.rs b/sql/src/plan.rs index e734ed826a..b17925083d 100644 --- a/sql/src/plan.rs +++ b/sql/src/plan.rs @@ -156,12 +156,18 @@ pub struct ShowCreatePlan { pub obj_type: ShowCreateObject, } +#[derive(Debug, PartialEq, Eq)] +pub struct ShowTablesPlan { + pub if_fuzzy: bool, + pub fuzzy_target: Option, +} + #[derive(Debug)] pub enum ShowPlan { /// show create table ShowCreatePlan(ShowCreatePlan), /// show tables - ShowTables, + ShowTablesPlan(ShowTablesPlan), /// show database ShowDatabase, } diff --git a/sql/src/planner.rs b/sql/src/planner.rs index 83f830e9d6..b4fc80e6ba 100644 --- a/sql/src/planner.rs +++ b/sql/src/planner.rs @@ -39,13 +39,13 @@ use table_engine::table::TableRef; use crate::{ ast::{ AlterAddColumn, AlterModifySetting, CreateTable, DescribeTable, DropTable, ExistsTable, - ShowCreate, Statement, TableName, + ShowCreate, Statement, TableName, ShowTables }, container::TableReference, parser, plan::{ AlterTableOperation, AlterTablePlan, CreateTablePlan, DescribeTablePlan, DropTablePlan, - ExistsTablePlan, InsertPlan, Plan, QueryPlan, ShowCreatePlan, ShowPlan, + ExistsTablePlan, InsertPlan, Plan, QueryPlan, ShowCreatePlan, ShowPlan, ShowTablesPlan, }, promql::{ColumnNames, Expr as PromExpr}, provider::{ContextProviderAdapter, MetaProvider}, @@ -246,7 +246,7 @@ impl<'a, P: MetaProvider> Planner<'a, P> { Statement::AlterModifySetting(s) => planner.alter_modify_setting_to_plan(s), Statement::AlterAddColumn(s) => planner.alter_add_column_to_plan(s), Statement::ShowCreate(s) => planner.show_create_to_plan(s), - Statement::ShowTables => planner.show_tables_to_plan(), + Statement::ShowTables(s) => planner.show_tables_to_plan(s), Statement::ShowDatabases => planner.show_databases_to_plan(), Statement::Exists(s) => planner.exists_table_to_plan(s), } @@ -598,8 +598,12 @@ impl<'a, P: MetaProvider> PlannerDelegate<'a, P> { Ok(Plan::Show(ShowPlan::ShowCreatePlan(plan))) } - fn show_tables_to_plan(&self) -> Result { - Ok(Plan::Show(ShowPlan::ShowTables)) + fn show_tables_to_plan(&self,show_tables: ShowTables) -> Result { + let plan = ShowTablesPlan { + if_fuzzy : show_tables.if_fuzzy, + fuzzy_target: show_tables.fuzzy_target, + }; + Ok(Plan::Show(ShowPlan::ShowTablesPlan(plan))) } fn show_databases_to_plan(&self) -> Result { From c21b90406be546a6412b31f76e7923604ecc06f1 Mon Sep 17 00:00:00 2001 From: QuintinTao Date: Fri, 21 Oct 2022 18:59:40 +0800 Subject: [PATCH 02/28] add supporting for show tables --- interpreters/src/show.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interpreters/src/show.rs b/interpreters/src/show.rs index 8a57860f17..774c352820 100644 --- a/interpreters/src/show.rs +++ b/interpreters/src/show.rs @@ -103,7 +103,7 @@ impl ShowInterpreter { .all_tables() .context(FetchTables)? .iter() - .filter(|t| t.name().contains(plan.fuzzy_target.as_ref().unwrap().as_ref())) + .filter(|t| t.name().contains::<&str>(plan.fuzzy_target.as_ref().unwrap().as_ref())) .map(|t| t.name().to_string()) .collect::>(), false => From 9dc3d7cc526b50695aa2dc8fe865b6b2595b7f06 Mon Sep 17 00:00:00 2001 From: QuintinTao Date: Fri, 21 Oct 2022 21:47:38 +0800 Subject: [PATCH 03/28] modify fmt --- interpreters/src/show.rs | 16 +++++++++------- sql/src/parser.rs | 14 ++++++-------- sql/src/planner.rs | 6 +++--- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/interpreters/src/show.rs b/interpreters/src/show.rs index 774c352820..0cda79b9f8 100644 --- a/interpreters/src/show.rs +++ b/interpreters/src/show.rs @@ -12,9 +12,8 @@ use catalog::{manager::ManagerRef, schema::Schema, Catalog}; use snafu::{Backtrace, OptionExt, ResultExt, Snafu}; use sql::{ ast::ShowCreateObject, - plan::{ShowCreatePlan, ShowPlan}, + plan::{ShowCreatePlan, ShowPlan, ShowTablesPlan}, }; -use sql::plan::ShowTablesPlan; use crate::{ context::Context, @@ -95,11 +94,15 @@ impl ShowInterpreter { show_create.execute_show_create() } - fn show_tables(ctx: Context, catalog_manager: ManagerRef,plan: ShowTablesPlan) -> Result { + fn show_tables( + ctx: Context, + catalog_manager: ManagerRef, + plan: ShowTablesPlan, + ) -> Result { let schema = get_default_schema(&ctx, &catalog_manager)?; - let tables_names = match plan.if_fuzzy { - true => schema + let tables_names = match plan.if_fuzzy { + true => schema .all_tables() .context(FetchTables)? .iter() @@ -122,8 +125,7 @@ impl ShowInterpreter { let record_batch = RecordBatch::try_new( Arc::new(schema), vec![Arc::new(StringArray::from(tables_names))], - ) - .context(CreateRecordBatch)?; + ).context(CreateRecordBatch)?; let record_batch = record_batch.try_into().context(ToCommonRecordType)?; diff --git a/sql/src/parser.rs b/sql/src/parser.rs index 779781c155..39977653bc 100644 --- a/sql/src/parser.rs +++ b/sql/src/parser.rs @@ -234,16 +234,14 @@ impl<'a> Parser<'a> { } fn parse_show_tables(&mut self) -> Result { - let (if_fuzzy, fuzzy_target)= match self.parser.next_token() { - Token::Word(w) => - match w.keyword { - Keyword::LIKE => (true, Some(self.parser.next_token().to_string())), - _ => (false, None) - }, - + let (if_fuzzy, fuzzy_target) = match self.parser.next_token() { + Token::Word(w) => match w.keyword { + Keyword::LIKE => (true, Some(self.parser.next_token().to_string())), + _ => (false, None) + }, _ => (false, None), }; - Ok(Statement::ShowTables(ShowTables{ + Ok(Statement::ShowTables(ShowTables { if_fuzzy, fuzzy_target, })) diff --git a/sql/src/planner.rs b/sql/src/planner.rs index b4fc80e6ba..6d7041072c 100644 --- a/sql/src/planner.rs +++ b/sql/src/planner.rs @@ -39,7 +39,7 @@ use table_engine::table::TableRef; use crate::{ ast::{ AlterAddColumn, AlterModifySetting, CreateTable, DescribeTable, DropTable, ExistsTable, - ShowCreate, Statement, TableName, ShowTables + ShowCreate, ShowTables, Statement, TableName, }, container::TableReference, parser, @@ -598,9 +598,9 @@ impl<'a, P: MetaProvider> PlannerDelegate<'a, P> { Ok(Plan::Show(ShowPlan::ShowCreatePlan(plan))) } - fn show_tables_to_plan(&self,show_tables: ShowTables) -> Result { + fn show_tables_to_plan(&self, show_tables: ShowTables) -> Result { let plan = ShowTablesPlan { - if_fuzzy : show_tables.if_fuzzy, + if_fuzzy: show_tables.if_fuzzy, fuzzy_target: show_tables.fuzzy_target, }; Ok(Plan::Show(ShowPlan::ShowTablesPlan(plan))) From 7a0c2f754b4530527a96d4ccfd058afefce24ae8 Mon Sep 17 00:00:00 2001 From: QuintinTao Date: Sat, 22 Oct 2022 09:23:08 +0800 Subject: [PATCH 04/28] code fmt modify --- interpreters/src/show.rs | 23 +++++++++++++---------- sql/src/parser.rs | 4 ++-- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/interpreters/src/show.rs b/interpreters/src/show.rs index 0cda79b9f8..071fa2d54f 100644 --- a/interpreters/src/show.rs +++ b/interpreters/src/show.rs @@ -101,21 +101,23 @@ impl ShowInterpreter { ) -> Result { let schema = get_default_schema(&ctx, &catalog_manager)?; - let tables_names = match plan.if_fuzzy { + let tables_names= match plan.if_fuzzy { true => schema .all_tables() .context(FetchTables)? .iter() - .filter(|t| t.name().contains::<&str>(plan.fuzzy_target.as_ref().unwrap().as_ref())) + .filter(|t| { + t.name() + .contains::<&str>(plan.fuzzy_target.as_ref().unwrap().as_ref()) + }) + .map(|t| t.name().to_string()) + .collect::>(), + false => schema + .all_tables() + .context(FetchTables)? + .iter() .map(|t| t.name().to_string()) .collect::>(), - false => - schema - .all_tables() - .context(FetchTables)? - .iter() - .map(|t| t.name().to_string()) - .collect::>(), }; let schema = DataSchema::new(vec![Field::new( SHOW_TABLES_COLUMN_SCHEMA, @@ -125,7 +127,8 @@ impl ShowInterpreter { let record_batch = RecordBatch::try_new( Arc::new(schema), vec![Arc::new(StringArray::from(tables_names))], - ).context(CreateRecordBatch)?; + ) + .context(CreateRecordBatch)?; let record_batch = record_batch.try_into().context(ToCommonRecordType)?; diff --git a/sql/src/parser.rs b/sql/src/parser.rs index 39977653bc..902a1933da 100644 --- a/sql/src/parser.rs +++ b/sql/src/parser.rs @@ -16,7 +16,7 @@ use table_engine::ANALYTIC_ENGINE_TYPE; use crate::ast::{ AlterAddColumn, AlterModifySetting, CreateTable, DescribeTable, DropTable, ExistsTable, - ShowCreate, ShowCreateObject, Statement, ShowTables, + ShowCreate, ShowCreateObject, ShowTables, Statement }; define_result!(ParserError); @@ -237,7 +237,7 @@ impl<'a> Parser<'a> { let (if_fuzzy, fuzzy_target) = match self.parser.next_token() { Token::Word(w) => match w.keyword { Keyword::LIKE => (true, Some(self.parser.next_token().to_string())), - _ => (false, None) + _ => (false, None), }, _ => (false, None), }; From 5c9d13eb2bd9aff36bd85e4bc407d18770da2810 Mon Sep 17 00:00:00 2001 From: QuintinTao Date: Sat, 22 Oct 2022 10:36:24 +0800 Subject: [PATCH 05/28] code fmt modify --- interpreters/src/show.rs | 2 +- sql/src/parser.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/interpreters/src/show.rs b/interpreters/src/show.rs index 071fa2d54f..c203f43501 100644 --- a/interpreters/src/show.rs +++ b/interpreters/src/show.rs @@ -101,7 +101,7 @@ impl ShowInterpreter { ) -> Result { let schema = get_default_schema(&ctx, &catalog_manager)?; - let tables_names= match plan.if_fuzzy { + let tables_names = match plan.if_fuzzy { true => schema .all_tables() .context(FetchTables)? diff --git a/sql/src/parser.rs b/sql/src/parser.rs index 902a1933da..923474d021 100644 --- a/sql/src/parser.rs +++ b/sql/src/parser.rs @@ -16,7 +16,7 @@ use table_engine::ANALYTIC_ENGINE_TYPE; use crate::ast::{ AlterAddColumn, AlterModifySetting, CreateTable, DescribeTable, DropTable, ExistsTable, - ShowCreate, ShowCreateObject, ShowTables, Statement + ShowCreate, ShowCreateObject, ShowTables, Statement, }; define_result!(ParserError); From bd12a04974024524d6eecdc85d631bb397b3019e Mon Sep 17 00:00:00 2001 From: QuintinTao Date: Tue, 25 Oct 2022 06:08:02 +0800 Subject: [PATCH 06/28] reduce show tables param --- interpreters/src/show.rs | 18 +++++++++++------- sql/src/ast.rs | 1 - sql/src/parser.rs | 21 +++++++++++++-------- sql/src/plan.rs | 1 - sql/src/planner.rs | 5 +---- 5 files changed, 25 insertions(+), 21 deletions(-) diff --git a/interpreters/src/show.rs b/interpreters/src/show.rs index c203f43501..79bb8465a1 100644 --- a/interpreters/src/show.rs +++ b/interpreters/src/show.rs @@ -9,6 +9,7 @@ use arrow::{ }; use async_trait::async_trait; use catalog::{manager::ManagerRef, schema::Schema, Catalog}; +use regex::Regex; use snafu::{Backtrace, OptionExt, ResultExt, Snafu}; use sql::{ ast::ShowCreateObject, @@ -101,18 +102,15 @@ impl ShowInterpreter { ) -> Result { let schema = get_default_schema(&ctx, &catalog_manager)?; - let tables_names = match plan.if_fuzzy { - true => schema + let tables_names = match plan.fuzzy_target { + Some(sc) => schema .all_tables() .context(FetchTables)? .iter() - .filter(|t| { - t.name() - .contains::<&str>(plan.fuzzy_target.as_ref().unwrap().as_ref()) - }) + .filter(|t| search_str(t.name(), &sc)) .map(|t| t.name().to_string()) .collect::>(), - false => schema + None => schema .all_tables() .context(FetchTables)? .iter() @@ -161,6 +159,12 @@ impl ShowInterpreter { } } +fn search_str(str: &str, search_re: &str) -> bool { + let regex_str = search_re.replace('_', ".").replace('%', ".*"); + let re = Regex::new(®ex_str).unwrap(); + re.is_match(str) +} + #[async_trait] impl Interpreter for ShowInterpreter { async fn execute(self: Box) -> InterpreterResult { diff --git a/sql/src/ast.rs b/sql/src/ast.rs index 15c102714a..20ca5b1584 100644 --- a/sql/src/ast.rs +++ b/sql/src/ast.rs @@ -98,7 +98,6 @@ pub struct AlterAddColumn { #[derive(Debug, PartialEq, Eq)] pub struct ShowTables { - pub if_fuzzy: bool, pub fuzzy_target: Option, } diff --git a/sql/src/parser.rs b/sql/src/parser.rs index 923474d021..8863f3180b 100644 --- a/sql/src/parser.rs +++ b/sql/src/parser.rs @@ -234,17 +234,22 @@ impl<'a> Parser<'a> { } fn parse_show_tables(&mut self) -> Result { - let (if_fuzzy, fuzzy_target) = match self.parser.next_token() { + let fuzzy_target = match self.parser.next_token() { Token::Word(w) => match w.keyword { - Keyword::LIKE => (true, Some(self.parser.next_token().to_string())), - _ => (false, None), + Keyword::LIKE => self.get_all_like_tokens(), + _ => None, }, - _ => (false, None), + _ => None, }; - Ok(Statement::ShowTables(ShowTables { - if_fuzzy, - fuzzy_target, - })) + Ok(Statement::ShowTables(ShowTables { fuzzy_target })) + } + + fn get_all_like_tokens(&mut self) -> Option { + let mut fuzzy_str = self.parser.next_token().to_string(); + while !self.parser.consume_token(&Token::SemiColon) { + fuzzy_str += self.parser.next_token().to_string().as_str(); + } + Some(fuzzy_str) } fn parse_show_create(&mut self) -> Result { diff --git a/sql/src/plan.rs b/sql/src/plan.rs index b17925083d..2613d745a8 100644 --- a/sql/src/plan.rs +++ b/sql/src/plan.rs @@ -158,7 +158,6 @@ pub struct ShowCreatePlan { #[derive(Debug, PartialEq, Eq)] pub struct ShowTablesPlan { - pub if_fuzzy: bool, pub fuzzy_target: Option, } diff --git a/sql/src/planner.rs b/sql/src/planner.rs index 6d7041072c..8f65f552bf 100644 --- a/sql/src/planner.rs +++ b/sql/src/planner.rs @@ -600,7 +600,6 @@ impl<'a, P: MetaProvider> PlannerDelegate<'a, P> { fn show_tables_to_plan(&self, show_tables: ShowTables) -> Result { let plan = ShowTablesPlan { - if_fuzzy: show_tables.if_fuzzy, fuzzy_target: show_tables.fuzzy_target, }; Ok(Plan::Show(ShowPlan::ShowTablesPlan(plan))) @@ -1643,9 +1642,7 @@ mod tests { let sql = "SHOW TABLES;"; quick_test( sql, - r#"Show( - ShowTables, -)"#, + r#""Show(\n ShowTablesPlan(\n ShowTablesPlan {\n fuzzy_target: None,\n },\n ),\n)""#, ) .unwrap(); } From 314695da323a268dc293da0a3c58eae405f32238 Mon Sep 17 00:00:00 2001 From: QuintinTao Date: Tue, 25 Oct 2022 06:44:01 +0800 Subject: [PATCH 07/28] add integration test and regex dependency --- interpreters/Cargo.toml | 2 +- tests/cases/local/01_system/system_tables.sql | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/interpreters/Cargo.toml b/interpreters/Cargo.toml index 968488ffb2..f5b1fc0b0f 100644 --- a/interpreters/Cargo.toml +++ b/interpreters/Cargo.toml @@ -22,7 +22,7 @@ sql = { workspace = true } table_engine = { workspace = true } query_engine = { workspace = true } arrow = { workspace = true } - +regex = "1" [dev-dependencies] analytic_engine = { workspace = true, features = ["test"] } catalog_impls = { workspace = true } diff --git a/tests/cases/local/01_system/system_tables.sql b/tests/cases/local/01_system/system_tables.sql index 7b79bfe82c..284dec8019 100644 --- a/tests/cases/local/01_system/system_tables.sql +++ b/tests/cases/local/01_system/system_tables.sql @@ -25,3 +25,5 @@ WHERE -- FIXME SHOW TABLES `name` LIKE '01_system_table1'; + +SHOW TABLES LIKE '01%'; From 48ad5debbe69aaa7795e03c03568141b167023f7 Mon Sep 17 00:00:00 2001 From: QuintinTao Date: Tue, 25 Oct 2022 07:09:49 +0800 Subject: [PATCH 08/28] modify test case --- sql/src/planner.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/sql/src/planner.rs b/sql/src/planner.rs index 8f65f552bf..4f05e2523e 100644 --- a/sql/src/planner.rs +++ b/sql/src/planner.rs @@ -1642,7 +1642,13 @@ mod tests { let sql = "SHOW TABLES;"; quick_test( sql, - r#""Show(\n ShowTablesPlan(\n ShowTablesPlan {\n fuzzy_target: None,\n },\n ),\n)""#, + r#""Show( + ShowTablesPlan( + ShowTablesPlan { + fuzzy_target: None, + }, + ), + )""#, ) .unwrap(); } From 222a0e3dd91e70b017f7b75f2dec81e6fbfa920c Mon Sep 17 00:00:00 2001 From: QuintinTao Date: Tue, 25 Oct 2022 07:44:38 +0800 Subject: [PATCH 09/28] modify test case --- sql/src/planner.rs | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/sql/src/planner.rs b/sql/src/planner.rs index 4f05e2523e..18d5752142 100644 --- a/sql/src/planner.rs +++ b/sql/src/planner.rs @@ -1636,20 +1636,18 @@ mod tests { ) .unwrap(); } - #[test] fn test_show_tables_statement_to_plan() { let sql = "SHOW TABLES;"; quick_test( sql, - r#""Show( - ShowTablesPlan( - ShowTablesPlan { - fuzzy_target: None, - }, - ), - )""#, - ) + r#"Show( + ShowTablesPlan( + ShowTablesPlan { + fuzzy_target: None, + }, + ), +)""#, ) .unwrap(); } From 83c6261cd772053857a8d42c0f73678196c128b4 Mon Sep 17 00:00:00 2001 From: QuintinTao Date: Tue, 25 Oct 2022 08:02:19 +0800 Subject: [PATCH 10/28] modify test case fmt --- sql/src/planner.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sql/src/planner.rs b/sql/src/planner.rs index 18d5752142..94575a5e9f 100644 --- a/sql/src/planner.rs +++ b/sql/src/planner.rs @@ -1647,7 +1647,8 @@ mod tests { fuzzy_target: None, }, ), -)""#, ) +)""#, + ) .unwrap(); } From cff208f626296e4b23105df9f14d8dcce6427d59 Mon Sep 17 00:00:00 2001 From: QuintinTao Date: Tue, 25 Oct 2022 08:42:10 +0800 Subject: [PATCH 11/28] modify test case fmt --- sql/src/planner.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/src/planner.rs b/sql/src/planner.rs index 94575a5e9f..c6ea311e23 100644 --- a/sql/src/planner.rs +++ b/sql/src/planner.rs @@ -1647,7 +1647,7 @@ mod tests { fuzzy_target: None, }, ), -)""#, +)"#, ) .unwrap(); } From 2c1605114594461f3986263902285263d8db8ecf Mon Sep 17 00:00:00 2001 From: QuintinTao Date: Tue, 25 Oct 2022 09:34:30 +0800 Subject: [PATCH 12/28] modify test case --- tests/cases/local/01_system/system_tables.sql | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/cases/local/01_system/system_tables.sql b/tests/cases/local/01_system/system_tables.sql index 284dec8019..5ace3607c8 100644 --- a/tests/cases/local/01_system/system_tables.sql +++ b/tests/cases/local/01_system/system_tables.sql @@ -24,6 +24,4 @@ WHERE -- FIXME -SHOW TABLES `name` LIKE '01_system_table1'; - SHOW TABLES LIKE '01%'; From 083cd52d077dc474a8a5845dfafe99f98e7a1e2c Mon Sep 17 00:00:00 2001 From: QuintinTao Date: Tue, 25 Oct 2022 13:21:56 +0800 Subject: [PATCH 13/28] modify test case --- tests/cases/local/01_system/system_tables.sql | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/cases/local/01_system/system_tables.sql b/tests/cases/local/01_system/system_tables.sql index 5ace3607c8..27e8d3e55b 100644 --- a/tests/cases/local/01_system/system_tables.sql +++ b/tests/cases/local/01_system/system_tables.sql @@ -24,4 +24,5 @@ WHERE -- FIXME + SHOW TABLES LIKE '01%'; From 2d61f950c248903aa62fef0e1889c32eb2baa2e5 Mon Sep 17 00:00:00 2001 From: QuintinTao Date: Wed, 26 Oct 2022 14:25:41 +0800 Subject: [PATCH 14/28] modify param name --- interpreters/src/show.rs | 18 ++++++++++++++---- sql/src/ast.rs | 3 ++- sql/src/parser.rs | 4 ++-- sql/src/plan.rs | 3 ++- sql/src/planner.rs | 2 +- 5 files changed, 21 insertions(+), 9 deletions(-) diff --git a/interpreters/src/show.rs b/interpreters/src/show.rs index 79bb8465a1..40bcb80f7f 100644 --- a/interpreters/src/show.rs +++ b/interpreters/src/show.rs @@ -102,12 +102,12 @@ impl ShowInterpreter { ) -> Result { let schema = get_default_schema(&ctx, &catalog_manager)?; - let tables_names = match plan.fuzzy_target { + let tables_names = match plan.pattern { Some(sc) => schema .all_tables() .context(FetchTables)? .iter() - .filter(|t| search_str(t.name(), &sc)) + .filter(|t| is_table_matched(t.name(), &sc).unwrap()) .map(|t| t.name().to_string()) .collect::>(), None => schema @@ -159,10 +159,10 @@ impl ShowInterpreter { } } -fn search_str(str: &str, search_re: &str) -> bool { +fn is_table_matched(str: &str, search_re: &str) -> Result { let regex_str = search_re.replace('_', ".").replace('%', ".*"); let re = Regex::new(®ex_str).unwrap(); - re.is_match(str) + Ok(re.is_match(str)) } #[async_trait] @@ -207,3 +207,13 @@ fn get_default_schema( name: default_schema, }) } + +#[cfg(test)] +mod tests { + use crate::show::is_table_matched; + #[test] + fn test_is_table_matched() { + assert!(is_table_matched("01_system_table1", "01%").is_ok()); + assert!(is_table_matched("01_system_table1", "01_%").is_ok()); + } +} diff --git a/sql/src/ast.rs b/sql/src/ast.rs index 20ca5b1584..729fc8ff43 100644 --- a/sql/src/ast.rs +++ b/sql/src/ast.rs @@ -98,7 +98,8 @@ pub struct AlterAddColumn { #[derive(Debug, PartialEq, Eq)] pub struct ShowTables { - pub fuzzy_target: Option, + /// Like pattern + pub pattern: Option, } #[derive(Debug, PartialEq, Eq)] diff --git a/sql/src/parser.rs b/sql/src/parser.rs index 8863f3180b..e80c266c7c 100644 --- a/sql/src/parser.rs +++ b/sql/src/parser.rs @@ -234,14 +234,14 @@ impl<'a> Parser<'a> { } fn parse_show_tables(&mut self) -> Result { - let fuzzy_target = match self.parser.next_token() { + let pattern = match self.parser.next_token() { Token::Word(w) => match w.keyword { Keyword::LIKE => self.get_all_like_tokens(), _ => None, }, _ => None, }; - Ok(Statement::ShowTables(ShowTables { fuzzy_target })) + Ok(Statement::ShowTables(ShowTables { pattern })) } fn get_all_like_tokens(&mut self) -> Option { diff --git a/sql/src/plan.rs b/sql/src/plan.rs index 2613d745a8..3f3240ad45 100644 --- a/sql/src/plan.rs +++ b/sql/src/plan.rs @@ -158,7 +158,8 @@ pub struct ShowCreatePlan { #[derive(Debug, PartialEq, Eq)] pub struct ShowTablesPlan { - pub fuzzy_target: Option, + /// Like pattern + pub pattern: Option, } #[derive(Debug)] diff --git a/sql/src/planner.rs b/sql/src/planner.rs index c6ea311e23..177872661b 100644 --- a/sql/src/planner.rs +++ b/sql/src/planner.rs @@ -600,7 +600,7 @@ impl<'a, P: MetaProvider> PlannerDelegate<'a, P> { fn show_tables_to_plan(&self, show_tables: ShowTables) -> Result { let plan = ShowTablesPlan { - fuzzy_target: show_tables.fuzzy_target, + pattern: show_tables.pattern, }; Ok(Plan::Show(ShowPlan::ShowTablesPlan(plan))) } From 65f1a0751c2ca2b5ea0348ee14e3faa5b10809ea Mon Sep 17 00:00:00 2001 From: QuintinTao Date: Wed, 26 Oct 2022 14:47:30 +0800 Subject: [PATCH 15/28] modify test case --- sql/src/planner.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/src/planner.rs b/sql/src/planner.rs index 177872661b..34181366c3 100644 --- a/sql/src/planner.rs +++ b/sql/src/planner.rs @@ -1644,7 +1644,7 @@ mod tests { r#"Show( ShowTablesPlan( ShowTablesPlan { - fuzzy_target: None, + pattern: None, }, ), )"#, From b809369fa47a75f7681c7cc6421e522b8eb56724 Mon Sep 17 00:00:00 2001 From: QuintinTao Date: Wed, 26 Oct 2022 15:49:41 +0800 Subject: [PATCH 16/28] modify test case --- tests/cases/local/01_system/system_tables.sql | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/cases/local/01_system/system_tables.sql b/tests/cases/local/01_system/system_tables.sql index 27e8d3e55b..5ace3607c8 100644 --- a/tests/cases/local/01_system/system_tables.sql +++ b/tests/cases/local/01_system/system_tables.sql @@ -24,5 +24,4 @@ WHERE -- FIXME - SHOW TABLES LIKE '01%'; From ff18d1b37efb422b20fd01ba152ca51a08183087 Mon Sep 17 00:00:00 2001 From: QuintinTao Date: Fri, 28 Oct 2022 08:36:31 +0800 Subject: [PATCH 17/28] test result update --- tests/cases/local/01_system/system_tables.result | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/cases/local/01_system/system_tables.result b/tests/cases/local/01_system/system_tables.result index 352ea6de1b..6d98d0e1e8 100644 --- a/tests/cases/local/01_system/system_tables.result +++ b/tests/cases/local/01_system/system_tables.result @@ -27,7 +27,7 @@ timestamp,catalog,schema,table_name,engine, Timestamp(Timestamp(0)),String(StringBytes(b"ceresdb")),String(StringBytes(b"public")),String(StringBytes(b"01_system_table1")),String(StringBytes(b"Analytic")), -SHOW TABLES `name` LIKE '01_system_table1'; -Failed to execute query, err: Server(ServerError { code: 400, msg: "failed to parse sql. Caused by: Invalid sql, sql: SHOW TABLES `name` LIKE '01_system_table1';, err:sql parser error: Expected end of statement, found: `name`" }) +SHOW TABLES LIKE '01%'; +Tables, From b0686d3e19d1708563a15e1576bb2e5722f47145 Mon Sep 17 00:00:00 2001 From: QuintinTao Date: Fri, 28 Oct 2022 11:19:39 +0800 Subject: [PATCH 18/28] add cargo.lock --- Cargo.lock | 262 +++++++++++------------------------------------------ 1 file changed, 55 insertions(+), 207 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9db109f5dd..1867659f9a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -82,7 +82,7 @@ dependencies = [ [[package]] name = "analytic_engine" -version = "0.4.0" +version = "0.4.0-alpha" dependencies = [ "arc-swap 1.5.1", "arena", @@ -90,18 +90,18 @@ dependencies = [ "async-trait", "base64 0.13.0", "bytes 1.2.1", - "common_types 0.4.0", + "common_types 0.4.0-alpha", "common_util", "datafusion 12.0.0", "env_logger", "futures 0.3.21", "lazy_static", "log", - "object_store 0.4.0", + "object_store 0.4.0-alpha", "parquet 23.0.0", "parquet_ext", "prometheus 0.12.0", - "proto 0.4.0", + "proto 0.4.0-alpha", "protobuf", "serde", "serde_derive", @@ -144,7 +144,7 @@ checksum = "983cd8b9d4b02a6dc6ffa557262eb5858a27a0038ffffe21a0f133eaa819a164" [[package]] name = "arena" -version = "0.4.0" +version = "0.4.0-alpha" dependencies = [ "parking_lot 0.11.2", ] @@ -287,7 +287,7 @@ dependencies = [ [[package]] name = "arrow_ext" -version = "0.4.0" +version = "0.4.0-alpha" dependencies = [ "arrow 23.0.0", "uncover", @@ -456,7 +456,7 @@ checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" [[package]] name = "benchmarks" -version = "0.4.0" +version = "0.4.0-alpha" dependencies = [ "analytic_engine", "arena", @@ -464,16 +464,15 @@ dependencies = [ "arrow2", "base64 0.13.0", "clap", - "common_types 0.4.0", + "common_types 0.4.0-alpha", "common_util", "criterion", "env_logger", "futures 0.3.21", "log", - "object_store 0.4.0", + "object_store 0.4.0-alpha", "parquet 23.0.0", "parquet_ext", - "pprof", "rand 0.7.3", "serde", "serde_derive", @@ -790,7 +789,7 @@ checksum = "ec8a7b6a70fde80372154c65702f00a0f56f3e1c36abbc6c440484be248856db" [[package]] name = "bytes_ext" -version = "0.4.0" +version = "0.4.0-alpha" dependencies = [ "bytes 1.2.1", "snafu 0.6.10", @@ -815,10 +814,10 @@ checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" [[package]] name = "catalog" -version = "0.4.0" +version = "0.4.0-alpha" dependencies = [ "async-trait", - "common_types 0.4.0", + "common_types 0.4.0-alpha", "common_util", "snafu 0.6.10", "table_engine", @@ -826,13 +825,13 @@ dependencies = [ [[package]] name = "catalog_impls" -version = "0.4.0" +version = "0.4.0-alpha" dependencies = [ "analytic_engine", "async-trait", "catalog", "cluster", - "common_types 0.4.0", + "common_types 0.4.0-alpha", "common_util", "log", "meta_client", @@ -854,7 +853,7 @@ dependencies = [ [[package]] name = "ceresdb" -version = "0.4.0" +version = "0.4.0-alpha" dependencies = [ "analytic_engine", "catalog", @@ -867,6 +866,7 @@ dependencies = [ "log", "logger", "meta_client", + "openssl-sys", "query_engine", "server", "signal-hook", @@ -1001,12 +1001,12 @@ dependencies = [ [[package]] name = "cluster" -version = "0.4.0" +version = "0.4.0-alpha" dependencies = [ "analytic_engine", "async-trait", "ceresdbproto 0.1.0 (git+https://github.com/CeresDB/ceresdbproto.git?rev=29cb0c6fba76401fd9a4ae5b8cacc9002ad78650)", - "common_types 0.4.0", + "common_types 0.4.0-alpha", "common_util", "log", "meta_client", @@ -1070,7 +1070,7 @@ dependencies = [ [[package]] name = "common_types" -version = "0.4.0" +version = "0.4.0-alpha" dependencies = [ "arrow 23.0.0", "arrow_ext", @@ -1080,7 +1080,7 @@ dependencies = [ "datafusion 12.0.0", "murmur3", "paste 1.0.8", - "proto 0.4.0", + "proto 0.4.0-alpha", "protobuf", "serde", "serde_derive", @@ -1091,12 +1091,12 @@ dependencies = [ [[package]] name = "common_util" -version = "0.4.0" +version = "0.4.0-alpha" dependencies = [ "arrow 23.0.0", "backtrace", "chrono", - "common_types 0.4.0", + "common_types 0.4.0-alpha", "crossbeam-utils 0.8.11", "env_logger", "gag", @@ -1107,7 +1107,7 @@ dependencies = [ "nix 0.22.3", "pin-project-lite", "prometheus 0.12.0", - "proto 0.4.0", + "proto 0.4.0-alpha", "serde", "serde_derive", "slog", @@ -1198,15 +1198,6 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc" -[[package]] -name = "cpp_demangle" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eeaa953eaad386a53111e47172c2fedba671e5684c8dd601a5f474f4f118710f" -dependencies = [ - "cfg-if 1.0.0", -] - [[package]] name = "cpufeatures" version = "0.2.2" @@ -1700,15 +1691,6 @@ dependencies = [ "tokio 1.20.1", ] -[[package]] -name = "debugid" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef552e6f588e446098f6ba40d89ac146c8c7b64aade83c051ee00bb5d2bc18d" -dependencies = [ - "uuid 1.1.2", -] - [[package]] name = "derive_more" version = "0.99.17" @@ -1724,13 +1706,13 @@ dependencies = [ [[package]] name = "df_operator" -version = "0.4.0" +version = "0.4.0-alpha" dependencies = [ "arrow 23.0.0", "base64 0.13.0", "bincode", "chrono", - "common_types 0.4.0", + "common_types 0.4.0-alpha", "common_util", "datafusion 12.0.0", "datafusion-expr 12.0.0", @@ -1931,18 +1913,6 @@ dependencies = [ "winapi 0.3.9", ] -[[package]] -name = "findshlibs" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40b9e59cd0f7e0806cca4be089683ecb6434e602038df21fe6bf6711b2f07f64" -dependencies = [ - "cc", - "lazy_static", - "libc", - "winapi 0.3.9", -] - [[package]] name = "fixedbitset" version = "0.4.2" @@ -2668,24 +2638,6 @@ dependencies = [ "hashbrown", ] -[[package]] -name = "inferno" -version = "0.11.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb31a5d9068fccb34562007cd564bb08fff1478255b0534c549e93fcb658cd90" -dependencies = [ - "ahash 0.7.6", - "atty", - "indexmap", - "itoa 1.0.3", - "log", - "num-format", - "once_cell", - "quick-xml 0.23.1", - "rgb", - "str_stack", -] - [[package]] name = "instant" version = "0.1.12" @@ -2713,14 +2665,14 @@ dependencies = [ [[package]] name = "interpreters" -version = "0.4.0" +version = "0.4.0-alpha" dependencies = [ "analytic_engine", "arrow 23.0.0", "async-trait", "catalog", "catalog_impls", - "common_types 0.4.0", + "common_types 0.4.0-alpha", "common_util", "datafusion 12.0.0", "datafusion-expr 12.0.0", @@ -2728,6 +2680,7 @@ dependencies = [ "log", "meta_client", "query_engine", + "regex", "snafu 0.6.10", "sql", "table_engine", @@ -3067,7 +3020,7 @@ dependencies = [ [[package]] name = "logger" -version = "0.4.0" +version = "0.4.0-alpha" dependencies = [ "chrono", "log", @@ -3149,15 +3102,6 @@ version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" -[[package]] -name = "memmap2" -version = "0.5.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95af15f345b17af2efc8ead6080fb8bc376f8cec1b35277b935637595fe77498" -dependencies = [ - "libc", -] - [[package]] name = "memoffset" version = "0.5.6" @@ -3195,11 +3139,11 @@ dependencies = [ [[package]] name = "meta_client" -version = "0.4.0" +version = "0.4.0-alpha" dependencies = [ "async-trait", "ceresdbproto 0.1.0 (git+https://github.com/CeresDB/ceresdbproto.git?rev=29cb0c6fba76401fd9a4ae5b8cacc9002ad78650)", - "common_types 0.4.0", + "common_types 0.4.0-alpha", "common_util", "futures 0.3.21", "log", @@ -3503,17 +3447,6 @@ dependencies = [ "memoffset 0.6.5", ] -[[package]] -name = "nix" -version = "0.24.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "195cdbc1741b8134346d515b3a56a1c94b0912758009cfd53f99ea0f57b065fc" -dependencies = [ - "bitflags", - "cfg-if 1.0.0", - "libc", -] - [[package]] name = "nodrop" version = "0.1.14" @@ -3585,16 +3518,6 @@ dependencies = [ "num-traits", ] -[[package]] -name = "num-format" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bafe4179722c2894288ee77a9f044f02811c86af699344c498b0840c698a2465" -dependencies = [ - "arrayvec 0.4.12", - "itoa 0.4.8", -] - [[package]] name = "num-integer" version = "0.1.45" @@ -3668,7 +3591,7 @@ dependencies = [ [[package]] name = "object_store" -version = "0.4.0" +version = "0.4.0-alpha" dependencies = [ "async-trait", "bytes 1.2.1", @@ -3809,9 +3732,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-sys" -version = "0.9.75" +version = "0.9.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5f9bd0c2710541a3cda73d6f9ac4f1b240de4ae261065d309dbe73d9dceb42f" +checksum = "b03b84c3b2d099b81f0953422b4d4ad58761589d0229b5506356afca05a3670a" dependencies = [ "autocfg 1.1.0", "cc", @@ -3851,7 +3774,7 @@ dependencies = [ "derive_more", "httpdate", "log", - "quick-xml 0.18.1", + "quick-xml", "reqwest 0.11.11", "rust-crypto", ] @@ -4014,7 +3937,7 @@ dependencies = [ [[package]] name = "parquet_ext" -version = "0.4.0" +version = "0.4.0-alpha" dependencies = [ "arrow 23.0.0", "arrow_ext", @@ -4153,28 +4076,6 @@ dependencies = [ "plotters-backend", ] -[[package]] -name = "pprof" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6472bfed9475542ac46c518734a8d06d71b0f6cb2c17f904aa301711a57786f" -dependencies = [ - "backtrace", - "cfg-if 1.0.0", - "criterion", - "findshlibs", - "inferno", - "libc", - "log", - "nix 0.24.2", - "once_cell", - "parking_lot 0.12.1", - "smallvec 1.9.0", - "symbolic-demangle", - "tempfile", - "thiserror", -] - [[package]] name = "ppv-lite86" version = "0.2.16" @@ -4257,7 +4158,7 @@ dependencies = [ [[package]] name = "profile" -version = "0.4.0" +version = "0.4.0-alpha" dependencies = [ "jemalloc-ctl", "jemalloc-sys", @@ -4385,7 +4286,7 @@ dependencies = [ [[package]] name = "proto" -version = "0.4.0" +version = "0.4.0-alpha" dependencies = [ "protobuf", "protobuf-builder", @@ -4458,11 +4359,11 @@ dependencies = [ [[package]] name = "query_engine" -version = "0.4.0" +version = "0.4.0-alpha" dependencies = [ "arrow 23.0.0", "async-trait", - "common_types 0.4.0", + "common_types 0.4.0-alpha", "common_util", "datafusion 12.0.0", "datafusion-expr 12.0.0", @@ -4491,15 +4392,6 @@ dependencies = [ "memchr", ] -[[package]] -name = "quick-xml" -version = "0.23.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11bafc859c6815fbaffbbbf4229ecb767ac913fecb27f9ad4343662e9ef099ea" -dependencies = [ - "memchr", -] - [[package]] name = "quote" version = "1.0.21" @@ -4902,15 +4794,6 @@ dependencies = [ "winreg 0.10.1", ] -[[package]] -name = "rgb" -version = "0.8.34" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3603b7d71ca82644f79b5a06d1220e9a58ede60bd32255f698cb1af8838b8db3" -dependencies = [ - "bytemuck", -] - [[package]] name = "rle-decode-fast" version = "1.0.3" @@ -5230,7 +5113,7 @@ dependencies = [ [[package]] name = "server" -version = "0.4.0" +version = "0.4.0-alpha" dependencies = [ "analytic_engine", "arrow 23.0.0", @@ -5240,7 +5123,7 @@ dependencies = [ "catalog", "ceresdbproto 0.1.0 (git+https://github.com/CeresDB/ceresdbproto.git?rev=29cb0c6fba76401fd9a4ae5b8cacc9002ad78650)", "cluster", - "common_types 0.4.0", + "common_types 0.4.0-alpha", "common_util", "datafusion 12.0.0", "df_operator", @@ -5391,7 +5274,7 @@ dependencies = [ [[package]] name = "skiplist" -version = "0.4.0" +version = "0.4.0-alpha" dependencies = [ "arena", "bytes 1.2.1", @@ -5555,12 +5438,12 @@ checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" [[package]] name = "sql" -version = "0.4.0" +version = "0.4.0-alpha" dependencies = [ "arrow 23.0.0", "catalog", "ceresdbproto 0.1.0 (git+https://github.com/CeresDB/ceresdbproto.git?rev=29cb0c6fba76401fd9a4ae5b8cacc9002ad78650)", - "common_types 0.4.0", + "common_types 0.4.0-alpha", "common_util", "datafusion 12.0.0", "datafusion-expr 12.0.0", @@ -5594,12 +5477,6 @@ dependencies = [ "serde", ] -[[package]] -name = "stable_deref_trait" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" - [[package]] name = "static_assertions" version = "0.3.4" @@ -5612,12 +5489,6 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" -[[package]] -name = "str_stack" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9091b6114800a5f2141aee1d1b9d6ca3592ac062dc5decb3764ec5895a47b4eb" - [[package]] name = "streaming-decompression" version = "0.1.2" @@ -5744,29 +5615,6 @@ version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" -[[package]] -name = "symbolic-common" -version = "9.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "800963ba330b09a2ae4a4f7c6392b81fbc2784099a98c1eac68c3437aa9382b2" -dependencies = [ - "debugid", - "memmap2", - "stable_deref_trait", - "uuid 1.1.2", -] - -[[package]] -name = "symbolic-demangle" -version = "9.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b940a1fdbc72bb3369e38714efe6cd332dbbe46d093cf03d668b9ac390d1ad0" -dependencies = [ - "cpp_demangle", - "rustc-demangle", - "symbolic-common", -] - [[package]] name = "syn" version = "1.0.99" @@ -5798,16 +5646,16 @@ dependencies = [ [[package]] name = "system_catalog" -version = "0.4.0" +version = "0.4.0-alpha" dependencies = [ "arrow 23.0.0", "async-trait", "catalog", - "common_types 0.4.0", + "common_types 0.4.0-alpha", "common_util", "futures 0.3.21", "log", - "proto 0.4.0", + "proto 0.4.0-alpha", "protobuf", "snafu 0.6.10", "table_engine", @@ -5816,18 +5664,18 @@ dependencies = [ [[package]] name = "table_engine" -version = "0.4.0" +version = "0.4.0-alpha" dependencies = [ "arrow 23.0.0", "async-trait", - "common_types 0.4.0", + "common_types 0.4.0-alpha", "common_util", "datafusion 12.0.0", "datafusion-expr 12.0.0", "futures 0.3.21", "log", "parquet 23.0.0", - "proto 0.4.0", + "proto 0.4.0-alpha", "protobuf", "serde", "serde_derive", @@ -5838,7 +5686,7 @@ dependencies = [ [[package]] name = "table_kv" -version = "0.4.0" +version = "0.4.0-alpha" dependencies = [ "common_util", "log", @@ -6506,7 +6354,7 @@ dependencies = [ [[package]] name = "tracing_util" -version = "0.4.0" +version = "0.4.0-alpha" dependencies = [ "lazy_static", "tracing", @@ -6746,11 +6594,11 @@ checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" [[package]] name = "wal" -version = "0.4.0" +version = "0.4.0-alpha" dependencies = [ "async-trait", "chrono", - "common_types 0.4.0", + "common_types 0.4.0-alpha", "common_util", "env_logger", "futures 0.3.21", From a4381cc70301cfa01f618b77bfb948eaf50450f8 Mon Sep 17 00:00:00 2001 From: QuintinTao Date: Fri, 28 Oct 2022 15:07:05 +0800 Subject: [PATCH 19/28] update cargo.lock --- Cargo.lock | 264 +++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 208 insertions(+), 56 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1867659f9a..399ccdec15 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -82,7 +82,7 @@ dependencies = [ [[package]] name = "analytic_engine" -version = "0.4.0-alpha" +version = "0.4.0" dependencies = [ "arc-swap 1.5.1", "arena", @@ -90,18 +90,18 @@ dependencies = [ "async-trait", "base64 0.13.0", "bytes 1.2.1", - "common_types 0.4.0-alpha", + "common_types 0.4.0", "common_util", "datafusion 12.0.0", "env_logger", "futures 0.3.21", "lazy_static", "log", - "object_store 0.4.0-alpha", + "object_store 0.4.0", "parquet 23.0.0", "parquet_ext", "prometheus 0.12.0", - "proto 0.4.0-alpha", + "proto 0.4.0", "protobuf", "serde", "serde_derive", @@ -144,7 +144,7 @@ checksum = "983cd8b9d4b02a6dc6ffa557262eb5858a27a0038ffffe21a0f133eaa819a164" [[package]] name = "arena" -version = "0.4.0-alpha" +version = "0.4.0" dependencies = [ "parking_lot 0.11.2", ] @@ -287,7 +287,7 @@ dependencies = [ [[package]] name = "arrow_ext" -version = "0.4.0-alpha" +version = "0.4.0" dependencies = [ "arrow 23.0.0", "uncover", @@ -456,7 +456,7 @@ checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" [[package]] name = "benchmarks" -version = "0.4.0-alpha" +version = "0.4.0" dependencies = [ "analytic_engine", "arena", @@ -464,15 +464,16 @@ dependencies = [ "arrow2", "base64 0.13.0", "clap", - "common_types 0.4.0-alpha", + "common_types 0.4.0", "common_util", "criterion", "env_logger", "futures 0.3.21", "log", - "object_store 0.4.0-alpha", + "object_store 0.4.0", "parquet 23.0.0", "parquet_ext", + "pprof", "rand 0.7.3", "serde", "serde_derive", @@ -789,7 +790,7 @@ checksum = "ec8a7b6a70fde80372154c65702f00a0f56f3e1c36abbc6c440484be248856db" [[package]] name = "bytes_ext" -version = "0.4.0-alpha" +version = "0.4.0" dependencies = [ "bytes 1.2.1", "snafu 0.6.10", @@ -814,10 +815,10 @@ checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" [[package]] name = "catalog" -version = "0.4.0-alpha" +version = "0.4.0" dependencies = [ "async-trait", - "common_types 0.4.0-alpha", + "common_types 0.4.0", "common_util", "snafu 0.6.10", "table_engine", @@ -825,13 +826,13 @@ dependencies = [ [[package]] name = "catalog_impls" -version = "0.4.0-alpha" +version = "0.4.0" dependencies = [ "analytic_engine", "async-trait", "catalog", "cluster", - "common_types 0.4.0-alpha", + "common_types 0.4.0", "common_util", "log", "meta_client", @@ -853,7 +854,7 @@ dependencies = [ [[package]] name = "ceresdb" -version = "0.4.0-alpha" +version = "0.4.0" dependencies = [ "analytic_engine", "catalog", @@ -866,7 +867,6 @@ dependencies = [ "log", "logger", "meta_client", - "openssl-sys", "query_engine", "server", "signal-hook", @@ -1001,12 +1001,12 @@ dependencies = [ [[package]] name = "cluster" -version = "0.4.0-alpha" +version = "0.4.0" dependencies = [ "analytic_engine", "async-trait", "ceresdbproto 0.1.0 (git+https://github.com/CeresDB/ceresdbproto.git?rev=29cb0c6fba76401fd9a4ae5b8cacc9002ad78650)", - "common_types 0.4.0-alpha", + "common_types 0.4.0", "common_util", "log", "meta_client", @@ -1070,7 +1070,7 @@ dependencies = [ [[package]] name = "common_types" -version = "0.4.0-alpha" +version = "0.4.0" dependencies = [ "arrow 23.0.0", "arrow_ext", @@ -1080,7 +1080,7 @@ dependencies = [ "datafusion 12.0.0", "murmur3", "paste 1.0.8", - "proto 0.4.0-alpha", + "proto 0.4.0", "protobuf", "serde", "serde_derive", @@ -1091,12 +1091,12 @@ dependencies = [ [[package]] name = "common_util" -version = "0.4.0-alpha" +version = "0.4.0" dependencies = [ "arrow 23.0.0", "backtrace", "chrono", - "common_types 0.4.0-alpha", + "common_types 0.4.0", "crossbeam-utils 0.8.11", "env_logger", "gag", @@ -1107,7 +1107,7 @@ dependencies = [ "nix 0.22.3", "pin-project-lite", "prometheus 0.12.0", - "proto 0.4.0-alpha", + "proto 0.4.0", "serde", "serde_derive", "slog", @@ -1198,6 +1198,15 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc" +[[package]] +name = "cpp_demangle" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eeaa953eaad386a53111e47172c2fedba671e5684c8dd601a5f474f4f118710f" +dependencies = [ + "cfg-if 1.0.0", +] + [[package]] name = "cpufeatures" version = "0.2.2" @@ -1691,6 +1700,15 @@ dependencies = [ "tokio 1.20.1", ] +[[package]] +name = "debugid" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef552e6f588e446098f6ba40d89ac146c8c7b64aade83c051ee00bb5d2bc18d" +dependencies = [ + "uuid 1.1.2", +] + [[package]] name = "derive_more" version = "0.99.17" @@ -1706,13 +1724,13 @@ dependencies = [ [[package]] name = "df_operator" -version = "0.4.0-alpha" +version = "0.4.0" dependencies = [ "arrow 23.0.0", "base64 0.13.0", "bincode", "chrono", - "common_types 0.4.0-alpha", + "common_types 0.4.0", "common_util", "datafusion 12.0.0", "datafusion-expr 12.0.0", @@ -1913,6 +1931,18 @@ dependencies = [ "winapi 0.3.9", ] +[[package]] +name = "findshlibs" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40b9e59cd0f7e0806cca4be089683ecb6434e602038df21fe6bf6711b2f07f64" +dependencies = [ + "cc", + "lazy_static", + "libc", + "winapi 0.3.9", +] + [[package]] name = "fixedbitset" version = "0.4.2" @@ -2638,6 +2668,24 @@ dependencies = [ "hashbrown", ] +[[package]] +name = "inferno" +version = "0.11.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb31a5d9068fccb34562007cd564bb08fff1478255b0534c549e93fcb658cd90" +dependencies = [ + "ahash 0.7.6", + "atty", + "indexmap", + "itoa 1.0.3", + "log", + "num-format", + "once_cell", + "quick-xml 0.23.1", + "rgb", + "str_stack", +] + [[package]] name = "instant" version = "0.1.12" @@ -2665,14 +2713,14 @@ dependencies = [ [[package]] name = "interpreters" -version = "0.4.0-alpha" +version = "0.4.0" dependencies = [ "analytic_engine", "arrow 23.0.0", "async-trait", "catalog", "catalog_impls", - "common_types 0.4.0-alpha", + "common_types 0.4.0", "common_util", "datafusion 12.0.0", "datafusion-expr 12.0.0", @@ -2680,7 +2728,6 @@ dependencies = [ "log", "meta_client", "query_engine", - "regex", "snafu 0.6.10", "sql", "table_engine", @@ -3020,7 +3067,7 @@ dependencies = [ [[package]] name = "logger" -version = "0.4.0-alpha" +version = "0.4.0" dependencies = [ "chrono", "log", @@ -3102,6 +3149,15 @@ version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" +[[package]] +name = "memmap2" +version = "0.5.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95af15f345b17af2efc8ead6080fb8bc376f8cec1b35277b935637595fe77498" +dependencies = [ + "libc", +] + [[package]] name = "memoffset" version = "0.5.6" @@ -3139,11 +3195,11 @@ dependencies = [ [[package]] name = "meta_client" -version = "0.4.0-alpha" +version = "0.4.0" dependencies = [ "async-trait", "ceresdbproto 0.1.0 (git+https://github.com/CeresDB/ceresdbproto.git?rev=29cb0c6fba76401fd9a4ae5b8cacc9002ad78650)", - "common_types 0.4.0-alpha", + "common_types 0.4.0", "common_util", "futures 0.3.21", "log", @@ -3447,6 +3503,17 @@ dependencies = [ "memoffset 0.6.5", ] +[[package]] +name = "nix" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "195cdbc1741b8134346d515b3a56a1c94b0912758009cfd53f99ea0f57b065fc" +dependencies = [ + "bitflags", + "cfg-if 1.0.0", + "libc", +] + [[package]] name = "nodrop" version = "0.1.14" @@ -3518,6 +3585,16 @@ dependencies = [ "num-traits", ] +[[package]] +name = "num-format" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bafe4179722c2894288ee77a9f044f02811c86af699344c498b0840c698a2465" +dependencies = [ + "arrayvec 0.4.12", + "itoa 0.4.8", +] + [[package]] name = "num-integer" version = "0.1.45" @@ -3591,7 +3668,7 @@ dependencies = [ [[package]] name = "object_store" -version = "0.4.0-alpha" +version = "0.4.0" dependencies = [ "async-trait", "bytes 1.2.1", @@ -3732,9 +3809,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-sys" -version = "0.9.77" +version = "0.9.75" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b03b84c3b2d099b81f0953422b4d4ad58761589d0229b5506356afca05a3670a" +checksum = "e5f9bd0c2710541a3cda73d6f9ac4f1b240de4ae261065d309dbe73d9dceb42f" dependencies = [ "autocfg 1.1.0", "cc", @@ -3774,7 +3851,7 @@ dependencies = [ "derive_more", "httpdate", "log", - "quick-xml", + "quick-xml 0.18.1", "reqwest 0.11.11", "rust-crypto", ] @@ -3937,7 +4014,7 @@ dependencies = [ [[package]] name = "parquet_ext" -version = "0.4.0-alpha" +version = "0.4.0" dependencies = [ "arrow 23.0.0", "arrow_ext", @@ -4076,6 +4153,28 @@ dependencies = [ "plotters-backend", ] +[[package]] +name = "pprof" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6472bfed9475542ac46c518734a8d06d71b0f6cb2c17f904aa301711a57786f" +dependencies = [ + "backtrace", + "cfg-if 1.0.0", + "criterion", + "findshlibs", + "inferno", + "libc", + "log", + "nix 0.24.2", + "once_cell", + "parking_lot 0.12.1", + "smallvec 1.9.0", + "symbolic-demangle", + "tempfile", + "thiserror", +] + [[package]] name = "ppv-lite86" version = "0.2.16" @@ -4158,7 +4257,7 @@ dependencies = [ [[package]] name = "profile" -version = "0.4.0-alpha" +version = "0.4.0" dependencies = [ "jemalloc-ctl", "jemalloc-sys", @@ -4286,7 +4385,7 @@ dependencies = [ [[package]] name = "proto" -version = "0.4.0-alpha" +version = "0.4.0" dependencies = [ "protobuf", "protobuf-builder", @@ -4359,11 +4458,11 @@ dependencies = [ [[package]] name = "query_engine" -version = "0.4.0-alpha" +version = "0.4.0" dependencies = [ "arrow 23.0.0", "async-trait", - "common_types 0.4.0-alpha", + "common_types 0.4.0", "common_util", "datafusion 12.0.0", "datafusion-expr 12.0.0", @@ -4392,6 +4491,15 @@ dependencies = [ "memchr", ] +[[package]] +name = "quick-xml" +version = "0.23.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11bafc859c6815fbaffbbbf4229ecb767ac913fecb27f9ad4343662e9ef099ea" +dependencies = [ + "memchr", +] + [[package]] name = "quote" version = "1.0.21" @@ -4794,6 +4902,15 @@ dependencies = [ "winreg 0.10.1", ] +[[package]] +name = "rgb" +version = "0.8.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3603b7d71ca82644f79b5a06d1220e9a58ede60bd32255f698cb1af8838b8db3" +dependencies = [ + "bytemuck", +] + [[package]] name = "rle-decode-fast" version = "1.0.3" @@ -5113,7 +5230,7 @@ dependencies = [ [[package]] name = "server" -version = "0.4.0-alpha" +version = "0.4.0" dependencies = [ "analytic_engine", "arrow 23.0.0", @@ -5123,7 +5240,7 @@ dependencies = [ "catalog", "ceresdbproto 0.1.0 (git+https://github.com/CeresDB/ceresdbproto.git?rev=29cb0c6fba76401fd9a4ae5b8cacc9002ad78650)", "cluster", - "common_types 0.4.0-alpha", + "common_types 0.4.0", "common_util", "datafusion 12.0.0", "df_operator", @@ -5274,7 +5391,7 @@ dependencies = [ [[package]] name = "skiplist" -version = "0.4.0-alpha" +version = "0.4.0" dependencies = [ "arena", "bytes 1.2.1", @@ -5438,12 +5555,12 @@ checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" [[package]] name = "sql" -version = "0.4.0-alpha" +version = "0.4.0" dependencies = [ "arrow 23.0.0", "catalog", "ceresdbproto 0.1.0 (git+https://github.com/CeresDB/ceresdbproto.git?rev=29cb0c6fba76401fd9a4ae5b8cacc9002ad78650)", - "common_types 0.4.0-alpha", + "common_types 0.4.0", "common_util", "datafusion 12.0.0", "datafusion-expr 12.0.0", @@ -5477,6 +5594,12 @@ dependencies = [ "serde", ] +[[package]] +name = "stable_deref_trait" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" + [[package]] name = "static_assertions" version = "0.3.4" @@ -5489,6 +5612,12 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" +[[package]] +name = "str_stack" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9091b6114800a5f2141aee1d1b9d6ca3592ac062dc5decb3764ec5895a47b4eb" + [[package]] name = "streaming-decompression" version = "0.1.2" @@ -5615,6 +5744,29 @@ version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" +[[package]] +name = "symbolic-common" +version = "9.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "800963ba330b09a2ae4a4f7c6392b81fbc2784099a98c1eac68c3437aa9382b2" +dependencies = [ + "debugid", + "memmap2", + "stable_deref_trait", + "uuid 1.1.2", +] + +[[package]] +name = "symbolic-demangle" +version = "9.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b940a1fdbc72bb3369e38714efe6cd332dbbe46d093cf03d668b9ac390d1ad0" +dependencies = [ + "cpp_demangle", + "rustc-demangle", + "symbolic-common", +] + [[package]] name = "syn" version = "1.0.99" @@ -5646,16 +5798,16 @@ dependencies = [ [[package]] name = "system_catalog" -version = "0.4.0-alpha" +version = "0.4.0" dependencies = [ "arrow 23.0.0", "async-trait", "catalog", - "common_types 0.4.0-alpha", + "common_types 0.4.0", "common_util", "futures 0.3.21", "log", - "proto 0.4.0-alpha", + "proto 0.4.0", "protobuf", "snafu 0.6.10", "table_engine", @@ -5664,18 +5816,18 @@ dependencies = [ [[package]] name = "table_engine" -version = "0.4.0-alpha" +version = "0.4.0" dependencies = [ "arrow 23.0.0", "async-trait", - "common_types 0.4.0-alpha", + "common_types 0.4.0", "common_util", "datafusion 12.0.0", "datafusion-expr 12.0.0", "futures 0.3.21", "log", "parquet 23.0.0", - "proto 0.4.0-alpha", + "proto 0.4.0", "protobuf", "serde", "serde_derive", @@ -5686,7 +5838,7 @@ dependencies = [ [[package]] name = "table_kv" -version = "0.4.0-alpha" +version = "0.4.0" dependencies = [ "common_util", "log", @@ -6354,7 +6506,7 @@ dependencies = [ [[package]] name = "tracing_util" -version = "0.4.0-alpha" +version = "0.4.0" dependencies = [ "lazy_static", "tracing", @@ -6594,11 +6746,11 @@ checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" [[package]] name = "wal" -version = "0.4.0-alpha" +version = "0.4.0" dependencies = [ "async-trait", "chrono", - "common_types 0.4.0-alpha", + "common_types 0.4.0", "common_util", "env_logger", "futures 0.3.21", @@ -6967,4 +7119,4 @@ checksum = "9fd07cbbc53846d9145dbffdf6dd09a7a0aa52be46741825f5c97bdd4f73f12b" dependencies = [ "cc", "libc", -] +] \ No newline at end of file From 03bdecca04791986aba2ed03888f16b5387f4105 Mon Sep 17 00:00:00 2001 From: QuintinTao Date: Fri, 28 Oct 2022 16:10:32 +0800 Subject: [PATCH 20/28] update cargo.lock --- Cargo.lock | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index 399ccdec15..cf0305a7a4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2728,6 +2728,7 @@ dependencies = [ "log", "meta_client", "query_engine", + "regex", "snafu 0.6.10", "sql", "table_engine", @@ -7119,4 +7120,4 @@ checksum = "9fd07cbbc53846d9145dbffdf6dd09a7a0aa52be46741825f5c97bdd4f73f12b" dependencies = [ "cc", "libc", -] \ No newline at end of file +] From 3c55ef32ee3b4fcb1ec9e10a5b6d3ac68ca58ce2 Mon Sep 17 00:00:00 2001 From: QuintinTao Date: Fri, 28 Oct 2022 17:32:15 +0800 Subject: [PATCH 21/28] modify test case result --- tests/cases/local/01_system/system_tables.result | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/cases/local/01_system/system_tables.result b/tests/cases/local/01_system/system_tables.result index 6d98d0e1e8..8fad0b5254 100644 --- a/tests/cases/local/01_system/system_tables.result +++ b/tests/cases/local/01_system/system_tables.result @@ -30,4 +30,4 @@ Timestamp(Timestamp(0)),String(StringBytes(b"ceresdb")),String(StringBytes(b"pub SHOW TABLES LIKE '01%'; -Tables, +"Tables":"01_system_table1" From 845e3cd74801a1cc23de412ae7e936b1ebd62391 Mon Sep 17 00:00:00 2001 From: QuintinTao Date: Mon, 31 Oct 2022 16:48:30 +0800 Subject: [PATCH 22/28] modify test result --- tests/cases/local/01_system/system_tables.result | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/cases/local/01_system/system_tables.result b/tests/cases/local/01_system/system_tables.result index 8fad0b5254..6d98d0e1e8 100644 --- a/tests/cases/local/01_system/system_tables.result +++ b/tests/cases/local/01_system/system_tables.result @@ -30,4 +30,4 @@ Timestamp(Timestamp(0)),String(StringBytes(b"ceresdb")),String(StringBytes(b"pub SHOW TABLES LIKE '01%'; -"Tables":"01_system_table1" +Tables, From 0dac07a95a3c7be923d00e5a3479571b6c0e2f91 Mon Sep 17 00:00:00 2001 From: QuintinTao Date: Tue, 1 Nov 2022 16:02:23 +0800 Subject: [PATCH 23/28] modify test reuslt --- tests/cases/local/01_system/system_tables.result | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/cases/local/01_system/system_tables.result b/tests/cases/local/01_system/system_tables.result index 6d98d0e1e8..8b9cb69efc 100644 --- a/tests/cases/local/01_system/system_tables.result +++ b/tests/cases/local/01_system/system_tables.result @@ -31,3 +31,5 @@ Timestamp(Timestamp(0)),String(StringBytes(b"ceresdb")),String(StringBytes(b"pub SHOW TABLES LIKE '01%'; Tables, + + From 52bfa593f2c93e9105e15406b04a08ed0b1832ba Mon Sep 17 00:00:00 2001 From: QuintinTao Date: Thu, 3 Nov 2022 09:12:09 +0800 Subject: [PATCH 24/28] modify is_table_matched method and test result --- interpreters/src/show.rs | 6 ++++-- tests/cases/local/01_system/system_tables.result | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/interpreters/src/show.rs b/interpreters/src/show.rs index 40bcb80f7f..4537d47764 100644 --- a/interpreters/src/show.rs +++ b/interpreters/src/show.rs @@ -101,7 +101,6 @@ impl ShowInterpreter { plan: ShowTablesPlan, ) -> Result { let schema = get_default_schema(&ctx, &catalog_manager)?; - let tables_names = match plan.pattern { Some(sc) => schema .all_tables() @@ -160,7 +159,10 @@ impl ShowInterpreter { } fn is_table_matched(str: &str, search_re: &str) -> Result { - let regex_str = search_re.replace('_', ".").replace('%', ".*"); + let regex_str = search_re + .replace('\'', "") + .replace('_', ".") + .replace('%', ".*"); let re = Regex::new(®ex_str).unwrap(); Ok(re.is_match(str)) } diff --git a/tests/cases/local/01_system/system_tables.result b/tests/cases/local/01_system/system_tables.result index 8b9cb69efc..9075f68424 100644 --- a/tests/cases/local/01_system/system_tables.result +++ b/tests/cases/local/01_system/system_tables.result @@ -27,9 +27,9 @@ timestamp,catalog,schema,table_name,engine, Timestamp(Timestamp(0)),String(StringBytes(b"ceresdb")),String(StringBytes(b"public")),String(StringBytes(b"01_system_table1")),String(StringBytes(b"Analytic")), - SHOW TABLES LIKE '01%'; Tables, +String(StringBytes(b"01_system_table1")), From 5de3b0287dab38aeb33ad1e44a6522e6691156e8 Mon Sep 17 00:00:00 2001 From: QuintinTao Date: Fri, 4 Nov 2022 16:26:20 +0800 Subject: [PATCH 25/28] modify is_table_matched and test cases --- interpreters/src/show.rs | 57 +++++++++++++++++++++++++++++++++++----- sql/src/parser.rs | 10 +------ 2 files changed, 51 insertions(+), 16 deletions(-) diff --git a/interpreters/src/show.rs b/interpreters/src/show.rs index 4537d47764..823aef2944 100644 --- a/interpreters/src/show.rs +++ b/interpreters/src/show.rs @@ -159,11 +159,13 @@ impl ShowInterpreter { } fn is_table_matched(str: &str, search_re: &str) -> Result { - let regex_str = search_re - .replace('\'', "") - .replace('_', ".") - .replace('%', ".*"); - let re = Regex::new(®ex_str).unwrap(); + let regex_str = search_re.replace('_', "."); + let regex_st = if regex_str.contains('%') { + regex_str.replace('%', ".*") + } else { + format!("^{}$", ®ex_str) + }; + let re = Regex::new(®ex_st).unwrap(); Ok(re.is_match(str)) } @@ -214,8 +216,49 @@ fn get_default_schema( mod tests { use crate::show::is_table_matched; #[test] + fn test_is_table_matched() { - assert!(is_table_matched("01_system_table1", "01%").is_ok()); - assert!(is_table_matched("01_system_table1", "01_%").is_ok()); + assert_eq!( + "true".to_string(), + is_table_matched("01_system_table1", "01%") + .unwrap() + .to_string() + ); + assert_eq!( + "true".to_string(), + is_table_matched("01_system_table1", "01_%") + .unwrap() + .to_string() + ); + assert_eq!( + "false".to_string(), + is_table_matched("01_system_table1", "01_system_table") + .unwrap() + .to_string() + ); + assert_eq!( + "true".to_string(), + is_table_matched("01_system_table1", "01_system_table1") + .unwrap() + .to_string() + ); + assert_eq!( + "true".to_string(), + is_table_matched("01_system_table1", "01_system_table.") + .unwrap() + .to_string() + ); + assert_eq!( + "false".to_string(), + is_table_matched("01_system_table1", "01_system_tabl.") + .unwrap() + .to_string() + ); + assert_eq!( + "true".to_string(), + is_table_matched("01_system_table1", "%system%") + .unwrap() + .to_string() + ); } } diff --git a/sql/src/parser.rs b/sql/src/parser.rs index e80c266c7c..fceb7bb934 100644 --- a/sql/src/parser.rs +++ b/sql/src/parser.rs @@ -236,7 +236,7 @@ impl<'a> Parser<'a> { fn parse_show_tables(&mut self) -> Result { let pattern = match self.parser.next_token() { Token::Word(w) => match w.keyword { - Keyword::LIKE => self.get_all_like_tokens(), + Keyword::LIKE => Some(self.parser.parse_literal_string()?), _ => None, }, _ => None, @@ -244,14 +244,6 @@ impl<'a> Parser<'a> { Ok(Statement::ShowTables(ShowTables { pattern })) } - fn get_all_like_tokens(&mut self) -> Option { - let mut fuzzy_str = self.parser.next_token().to_string(); - while !self.parser.consume_token(&Token::SemiColon) { - fuzzy_str += self.parser.next_token().to_string().as_str(); - } - Some(fuzzy_str) - } - fn parse_show_create(&mut self) -> Result { let obj_type = match self.parser.expect_one_of_keywords(&[Keyword::TABLE])? { Keyword::TABLE => Ok(ShowCreateObject::Table), From b744274f91981cf5bbf1283ce04f749c76510602 Mon Sep 17 00:00:00 2001 From: QuintinTao Date: Tue, 8 Nov 2022 10:51:29 +0800 Subject: [PATCH 26/28] remove type conversion --- sql/src/parser.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/src/parser.rs b/sql/src/parser.rs index fceb7bb934..b188e34d1c 100644 --- a/sql/src/parser.rs +++ b/sql/src/parser.rs @@ -371,7 +371,7 @@ impl<'a> Parser<'a> { } build_timestamp_key_constraint(&columns, &mut constraints); - + debug!("columns:{:?}, constraints:{:?}", &columns, constraints); Ok((columns, constraints)) } From e80f843ba4efe01f1501e93949d68ab9bfe5543e Mon Sep 17 00:00:00 2001 From: QuintinTao Date: Tue, 8 Nov 2022 11:00:23 +0800 Subject: [PATCH 27/28] rollback --- sql/src/parser.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/src/parser.rs b/sql/src/parser.rs index b188e34d1c..27542ecfd3 100644 --- a/sql/src/parser.rs +++ b/sql/src/parser.rs @@ -371,7 +371,7 @@ impl<'a> Parser<'a> { } build_timestamp_key_constraint(&columns, &mut constraints); - debug!("columns:{:?}, constraints:{:?}", &columns, constraints); + Ok((columns, constraints)) } From a2713718fcc418d63f66bdeae58c9126c1032e7e Mon Sep 17 00:00:00 2001 From: QuintinTao Date: Tue, 8 Nov 2022 13:12:37 +0800 Subject: [PATCH 28/28] remove whitespace --- sql/src/parser.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/src/parser.rs b/sql/src/parser.rs index 27542ecfd3..fceb7bb934 100644 --- a/sql/src/parser.rs +++ b/sql/src/parser.rs @@ -371,7 +371,7 @@ impl<'a> Parser<'a> { } build_timestamp_key_constraint(&columns, &mut constraints); - + Ok((columns, constraints)) }