Skip to content

Commit 4681918

Browse files
authored
Merge branch 'main' into bug-drop-current-db
2 parents b653a72 + d054cca commit 4681918

File tree

17 files changed

+417
-116
lines changed

17 files changed

+417
-116
lines changed

src/common/storage/src/config.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -451,6 +451,7 @@ pub struct StorageMokaConfig {
451451
}
452452

453453
impl Default for StorageMokaConfig {
454+
#[no_sanitize(address)]
454455
fn default() -> Self {
455456
Self {
456457
// Use 1G as default.

src/common/storage/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
//! - Table snapshots, segments cache must be stored accessed via cache operator.
2929
//! - Intermediate data generated by query could be stored by temporary operator.
3030
31+
#![feature(no_sanitize)]
32+
3133
mod config;
3234
pub use config::CacheConfig;
3335
pub use config::ShareTableConfig;

src/query/ast/src/ast/statements/table.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ use crate::ast::UriLocation;
3030

3131
#[derive(Debug, Clone, PartialEq)] // Tables
3232
pub struct ShowTablesStmt<'a> {
33+
pub catalog: Option<Identifier<'a>>,
3334
pub database: Option<Identifier<'a>>,
3435
pub full: bool,
3536
pub limit: Option<ShowLimit<'a>>,
@@ -47,7 +48,11 @@ impl Display for ShowTablesStmt<'_> {
4748
write!(f, " HISTORY")?;
4849
}
4950
if let Some(database) = &self.database {
50-
write!(f, " FROM {database}")?;
51+
write!(f, " FROM ")?;
52+
if let Some(catalog) = &self.catalog {
53+
write!(f, "{catalog}.",)?;
54+
}
55+
write!(f, "{database}")?;
5156
}
5257
if let Some(limit) = &self.limit {
5358
write!(f, " {limit}")?;

src/query/ast/src/parser/statement.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -332,11 +332,17 @@ pub fn statement(i: Input) -> IResult<StatementMsg> {
332332
);
333333
let show_tables = map(
334334
rule! {
335-
SHOW ~ FULL? ~ TABLES ~ HISTORY? ~ ( ( FROM | IN ) ~ ^#ident )? ~ #show_limit?
335+
SHOW ~ FULL? ~ TABLES ~ HISTORY? ~ ( ( FROM | IN ) ~ #peroid_separated_idents_1_to_2 )? ~ #show_limit?
336336
},
337-
|(_, opt_full, _, opt_history, opt_database, limit)| {
337+
|(_, opt_full, _, opt_history, ctl_db, limit)| {
338+
let (catalog, database) = match ctl_db {
339+
Some((_, (Some(c), d))) => (Some(c), Some(d)),
340+
Some((_, (None, d))) => (None, Some(d)),
341+
_ => (None, None),
342+
};
338343
Statement::ShowTables(ShowTablesStmt {
339-
database: opt_database.map(|(_, database)| database),
344+
catalog,
345+
database,
340346
full: opt_full.is_some(),
341347
limit,
342348
with_history: opt_history.is_some(),

src/query/ast/tests/it/parser.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@ fn test_statement() {
6767
r#"show databases format TabSeparatedWithNamesAndTypes;"#,
6868
r#"show tables"#,
6969
r#"show tables format TabSeparatedWithNamesAndTypes;"#,
70+
r#"show full tables"#,
71+
r#"show full tables from db"#,
72+
r#"show full tables from ctl.db"#,
7073
r#"show processlist;"#,
7174
r#"show create table a.b;"#,
7275
r#"show create table a.b format TabSeparatedWithNamesAndTypes;"#,

src/query/ast/tests/it/testdata/statement.txt

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ SHOW TABLES
3737
---------- AST ------------
3838
ShowTables(
3939
ShowTablesStmt {
40+
catalog: None,
4041
database: None,
4142
full: false,
4243
limit: None,
@@ -52,6 +53,7 @@ SHOW TABLES
5253
---------- AST ------------
5354
ShowTables(
5455
ShowTablesStmt {
56+
catalog: None,
5557
database: None,
5658
full: false,
5759
limit: None,
@@ -64,6 +66,72 @@ ShowTables(
6466
Some(
6567
"TabSeparatedWithNamesAndTypes",
6668
)
69+
---------- Input ----------
70+
show full tables
71+
---------- Output ---------
72+
SHOW FULL TABLES
73+
---------- AST ------------
74+
ShowTables(
75+
ShowTablesStmt {
76+
catalog: None,
77+
database: None,
78+
full: true,
79+
limit: None,
80+
with_history: false,
81+
},
82+
)
83+
84+
85+
---------- Input ----------
86+
show full tables from db
87+
---------- Output ---------
88+
SHOW FULL TABLES FROM db
89+
---------- AST ------------
90+
ShowTables(
91+
ShowTablesStmt {
92+
catalog: None,
93+
database: Some(
94+
Identifier {
95+
name: "db",
96+
quote: None,
97+
span: Ident(22..24),
98+
},
99+
),
100+
full: true,
101+
limit: None,
102+
with_history: false,
103+
},
104+
)
105+
106+
107+
---------- Input ----------
108+
show full tables from ctl.db
109+
---------- Output ---------
110+
SHOW FULL TABLES FROM ctl.db
111+
---------- AST ------------
112+
ShowTables(
113+
ShowTablesStmt {
114+
catalog: Some(
115+
Identifier {
116+
name: "ctl",
117+
quote: None,
118+
span: Ident(22..25),
119+
},
120+
),
121+
database: Some(
122+
Identifier {
123+
name: "db",
124+
quote: None,
125+
span: Ident(26..28),
126+
},
127+
),
128+
full: true,
129+
limit: None,
130+
with_history: false,
131+
},
132+
)
133+
134+
67135
---------- Input ----------
68136
show processlist;
69137
---------- Output ---------

src/query/config/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15+
#![feature(no_sanitize)]
16+
1517
/// Config mods provide config support.
1618
///
1719
/// We are providing two config types:

src/query/config/src/outer_v0.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ impl Config {
136136
/// with_args is to control whether we need to load from args or not.
137137
/// We should set this to false during tests because we don't want
138138
/// our test binary to parse cargo's args.
139+
#[no_sanitize(address)]
139140
pub fn load(with_args: bool) -> Result<Self> {
140141
let mut arg_conf = Self::default();
141142

src/query/service/tests/it/servers/http/http_query_handlers.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ async fn test_simple_sql() -> Result<()> {
137137
assert!(result.schema.is_some(), "{:?}", result);
138138
assert_eq!(
139139
result.schema.as_ref().unwrap().fields().len(),
140-
10,
140+
11,
141141
"{:?}",
142142
result
143143
);

0 commit comments

Comments
 (0)