Skip to content

Commit 68fbe60

Browse files
authored
Merge branch 'main' into add_runtime_bloom_filter_for_merge_into
2 parents 3778c67 + c4dcf91 commit 68fbe60

File tree

29 files changed

+812
-125
lines changed

29 files changed

+812
-125
lines changed

.github/workflows/reuse.benchmark.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ jobs:
168168
env:
169169
BENDSQL_DSN: "databend://${{ secrets.BENCHMARK_CLOUD_USER }}:${{ secrets.BENCHMARK_CLOUD_PASSWORD }}@${{ secrets.BENCHMARK_CLOUD_GATEWAY }}:443/?warehouse=default"
170170
run: |
171-
echo "DROP DATABASE IF EXISTS 'load_test_${{ inputs.run_id }}';" | bendsql
171+
echo "DROP DATABASE IF EXISTS load_test_${{ inputs.run_id }};" | bendsql
172172
echo "DROP WAREHOUSE IF EXISTS 'benchmark-${{ inputs.run_id }}';" | bendsql
173173
174174
comment:

benchmark/clickbench/benchmark_cloud.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ export BENDSQL_DSN="databend://${CLOUD_USER}:${CLOUD_PASSWORD}@${CLOUD_GATEWAY}:
7575

7676
if [[ "${BENCHMARK_DATASET}" == "load" ]]; then
7777
echo "Creating database..."
78-
echo "DROP DATABASE IF EXISTS ${BENCHMARK_DATABASE};" | bendsql --database default
7978
echo "CREATE DATABASE ${BENCHMARK_DATABASE};" | bendsql --database default
8079
fi
8180

benchmark/clickbench/load/queries/00.sql

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
DROP TABLE IF EXISTS hits_csv;
2-
CREATE TABLE hits_csv (
1+
DROP TABLE IF EXISTS hits_parquet;
2+
CREATE TABLE hits_parquet (
33
WatchID BIGINT NOT NULL,
44
JavaEnable SMALLINT NOT NULL,
55
Title TEXT,
@@ -106,5 +106,5 @@ CREATE TABLE hits_csv (
106106
URLHash BIGINT NOT NULL,
107107
CLID INTEGER NOT NULL
108108
) CLUSTER BY (CounterID, EventDate, UserID, EventTime, WatchID);
109-
COPY INTO hits_csv
110-
FROM 's3://databend-datasets/hits_compatible/hits.csv.gz' CONNECTION = (CONNECTION_NAME = 'repo') FILE_FORMAT = (TYPE = 'CSV', COMPRESSION = AUTO);
109+
COPY INTO hits_parquet
110+
FROM 's3://databend-datasets/hits_compatible/hits.parquet' CONNECTION = (CONNECTION_NAME = 'repo') FILE_FORMAT = (TYPE = 'PARQUET');

benchmark/clickbench/load/queries/01.sql

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
DROP TABLE IF EXISTS hits_tsv;
2-
CREATE TABLE hits_tsv (
1+
DROP TABLE IF EXISTS hits_csv;
2+
CREATE TABLE hits_csv (
33
WatchID BIGINT NOT NULL,
44
JavaEnable SMALLINT NOT NULL,
55
Title TEXT,
@@ -106,5 +106,5 @@ CREATE TABLE hits_tsv (
106106
URLHash BIGINT NOT NULL,
107107
CLID INTEGER NOT NULL
108108
) CLUSTER BY (CounterID, EventDate, UserID, EventTime, WatchID);
109-
COPY INTO hits_tsv
110-
FROM 's3://databend-datasets/hits_compatible/hits.tsv.gz' CONNECTION = (CONNECTION_NAME = 'repo') FILE_FORMAT = (TYPE = 'TSV', COMPRESSION = AUTO);
109+
COPY INTO hits_csv
110+
FROM 's3://databend-datasets/hits_compatible/hits.csv.gz' CONNECTION = (CONNECTION_NAME = 'repo') FILE_FORMAT = (TYPE = 'CSV', COMPRESSION = AUTO);

benchmark/clickbench/load/queries/02.sql

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
DROP TABLE IF EXISTS hits_json;
2-
CREATE TABLE hits_json (
1+
DROP TABLE IF EXISTS hits_tsv;
2+
CREATE TABLE hits_tsv (
33
WatchID BIGINT NOT NULL,
44
JavaEnable SMALLINT NOT NULL,
55
Title TEXT,
@@ -106,5 +106,5 @@ CREATE TABLE hits_json (
106106
URLHash BIGINT NOT NULL,
107107
CLID INTEGER NOT NULL
108108
) CLUSTER BY (CounterID, EventDate, UserID, EventTime, WatchID);
109-
COPY INTO hits_json
110-
FROM 's3://databend-datasets/hits_compatible/hits.json.gz' CONNECTION = (CONNECTION_NAME = 'repo') FILE_FORMAT = (TYPE = 'NDJSON', COMPRESSION = AUTO);
109+
COPY INTO hits_tsv
110+
FROM 's3://databend-datasets/hits_compatible/hits.tsv.gz' CONNECTION = (CONNECTION_NAME = 'repo') FILE_FORMAT = (TYPE = 'TSV', COMPRESSION = AUTO);

benchmark/clickbench/load/queries/03.sql

Lines changed: 0 additions & 110 deletions
This file was deleted.

src/query/ast/src/ast/format/ast_format.rs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1723,6 +1723,33 @@ impl<'ast> Visitor<'ast> for AstFormatVisitor {
17231723
self.children.push(node);
17241724
}
17251725

1726+
fn visit_show_views(&mut self, stmt: &'ast ShowViewsStmt) {
1727+
let mut children = Vec::new();
1728+
if let Some(database) = &stmt.database {
1729+
let database_name = format!("Database {}", database);
1730+
let database_format_ctx = AstFormatContext::new(database_name);
1731+
let database_node = FormatTreeNode::new(database_format_ctx);
1732+
children.push(database_node);
1733+
}
1734+
if let Some(limit) = &stmt.limit {
1735+
self.visit_show_limit(limit);
1736+
children.push(self.children.pop().unwrap());
1737+
}
1738+
let name = "ShowViews".to_string();
1739+
let format_ctx = AstFormatContext::with_children(name, children.len());
1740+
let node = FormatTreeNode::with_children(format_ctx, children);
1741+
self.children.push(node);
1742+
}
1743+
1744+
fn visit_describe_view(&mut self, stmt: &'ast DescribeViewStmt) {
1745+
self.visit_table_ref(&stmt.catalog, &stmt.database, &stmt.view);
1746+
let child = self.children.pop().unwrap();
1747+
let name = "DescribeView".to_string();
1748+
let format_ctx = AstFormatContext::with_children(name, 1);
1749+
let node = FormatTreeNode::with_children(format_ctx, vec![child]);
1750+
self.children.push(node);
1751+
}
1752+
17261753
fn visit_create_stream(&mut self, stmt: &'ast CreateStreamStmt) {
17271754
let mut children = Vec::new();
17281755
self.visit_table_ref(&stmt.catalog, &stmt.database, &stmt.stream);

src/query/ast/src/ast/statements/statement.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,8 @@ pub enum Statement {
154154
CreateView(CreateViewStmt),
155155
AlterView(AlterViewStmt),
156156
DropView(DropViewStmt),
157+
ShowViews(ShowViewsStmt),
158+
DescribeView(DescribeViewStmt),
157159

158160
// Streams
159161
CreateStream(CreateStreamStmt),
@@ -549,6 +551,8 @@ impl Display for Statement {
549551
Statement::CreateView(stmt) => write!(f, "{stmt}")?,
550552
Statement::AlterView(stmt) => write!(f, "{stmt}")?,
551553
Statement::DropView(stmt) => write!(f, "{stmt}")?,
554+
Statement::ShowViews(stmt) => write!(f, "{stmt}")?,
555+
Statement::DescribeView(stmt) => write!(f, "{stmt}")?,
552556
Statement::CreateStream(stmt) => write!(f, "{stmt}")?,
553557
Statement::DropStream(stmt) => write!(f, "{stmt}")?,
554558
Statement::ShowStreams(stmt) => write!(f, "{stmt}")?,

src/query/ast/src/ast/statements/view.rs

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ use crate::ast::write_comma_separated_list;
2323
use crate::ast::write_dot_separated_list;
2424
use crate::ast::Identifier;
2525
use crate::ast::Query;
26+
use crate::ast::ShowLimit;
2627

2728
#[derive(Debug, Clone, PartialEq, Drive, DriveMut)]
2829
pub struct CreateViewStmt {
@@ -113,3 +114,58 @@ impl Display for DropViewStmt {
113114
)
114115
}
115116
}
117+
118+
#[derive(Debug, Clone, PartialEq, Drive, DriveMut)]
119+
pub struct ShowViewsStmt {
120+
pub catalog: Option<Identifier>,
121+
pub database: Option<Identifier>,
122+
#[drive(skip)]
123+
pub full: bool,
124+
pub limit: Option<ShowLimit>,
125+
#[drive(skip)]
126+
pub with_history: bool,
127+
}
128+
129+
impl Display for ShowViewsStmt {
130+
fn fmt(&self, f: &mut Formatter) -> std::fmt::Result {
131+
write!(f, "SHOW")?;
132+
if self.full {
133+
write!(f, " FULL")?;
134+
}
135+
write!(f, " VIEWS")?;
136+
if self.with_history {
137+
write!(f, " HISTORY")?;
138+
}
139+
if let Some(database) = &self.database {
140+
write!(f, " FROM ")?;
141+
if let Some(catalog) = &self.catalog {
142+
write!(f, "{catalog}.",)?;
143+
}
144+
write!(f, "{database}")?;
145+
}
146+
if let Some(limit) = &self.limit {
147+
write!(f, " {limit}")?;
148+
}
149+
150+
Ok(())
151+
}
152+
}
153+
154+
#[derive(Debug, Clone, PartialEq, Eq, Drive, DriveMut)]
155+
pub struct DescribeViewStmt {
156+
pub catalog: Option<Identifier>,
157+
pub database: Option<Identifier>,
158+
pub view: Identifier,
159+
}
160+
161+
impl Display for DescribeViewStmt {
162+
fn fmt(&self, f: &mut Formatter) -> std::fmt::Result {
163+
write!(f, "DESCRIBE ")?;
164+
write_dot_separated_list(
165+
f,
166+
self.catalog
167+
.iter()
168+
.chain(self.database.iter().chain(Some(&self.view))),
169+
)
170+
}
171+
}

src/query/ast/src/ast/visitors/visitor.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -572,6 +572,10 @@ pub trait Visitor<'ast>: Sized {
572572

573573
fn visit_drop_view(&mut self, _stmt: &'ast DropViewStmt) {}
574574

575+
fn visit_show_views(&mut self, _stmt: &'ast ShowViewsStmt) {}
576+
577+
fn visit_describe_view(&mut self, _stmt: &'ast DescribeViewStmt) {}
578+
575579
fn visit_create_stream(&mut self, _stmt: &'ast CreateStreamStmt) {}
576580

577581
fn visit_drop_stream(&mut self, _stmt: &'ast DropStreamStmt) {}

0 commit comments

Comments
 (0)