Skip to content

chore: remove ck client in sqllogictest #13882

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Cargo.lock

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

1 change: 0 additions & 1 deletion tests/sqllogictests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ clap = { workspace = true }
common-exception = { path = "../../src/common/exception" }
env_logger = "0.10.0"
futures-util = "0.3.25"
lazy_static = { workspace = true }
mysql_async = { workspace = true }
rand = "0.8.5"
regex = "1.8.1"
Expand Down
2 changes: 1 addition & 1 deletion tests/sqllogictests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ This is Databend's [sqllogictest](https://www.sqlite.org/sqllogictest/doc/trunk/
Before running the following commands, you should generate **databend-sqllogictests** binary file.

---
Run all tests under the three handlers(mysql, http, clickhouse) in turn.
Run all tests under the three handlers(mysql, http) in turn.
```shell
databend-sqllogictests
```
Expand Down
2 changes: 1 addition & 1 deletion tests/sqllogictests/src/arg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ pub struct SqlLogicTestArgs {
long = "handlers",
use_value_delimiter = true,
value_delimiter = ',',
help = "Choose handlers to run tests, support mysql, http, clickhouse handler, the arg is optional. If use multiple handlers, please use \',\' to split them"
help = "Choose handlers to run tests, support mysql, http handler, the arg is optional. If use multiple handlers, please use \',\' to split them"
)]
pub handlers: Option<Vec<String>>,

Expand Down
142 changes: 0 additions & 142 deletions tests/sqllogictests/src/client/clickhouse_client.rs

This file was deleted.

7 changes: 0 additions & 7 deletions tests/sqllogictests/src/client/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,12 @@
// See the License for the specific language governing permissions and
// limitations under the License.

mod clickhouse_client;
mod http_client;
mod mysql_client;

use std::borrow::Cow;
use std::fmt;

pub use clickhouse_client::ClickhouseHttpClient;
pub use http_client::HttpClient;
pub use mysql_client::MySQLClient;
use rand::distributions::Alphanumeric;
Expand All @@ -34,7 +32,6 @@ use crate::error::Result;
pub enum ClientType {
MySQL,
Http,
Clickhouse,
}

impl fmt::Display for ClientType {
Expand All @@ -46,7 +43,6 @@ impl fmt::Display for ClientType {
pub enum Client {
MySQL(MySQLClient),
Http(HttpClient),
Clickhouse(ClickhouseHttpClient),
}

impl Client {
Expand All @@ -55,15 +51,13 @@ impl Client {
match self {
Client::MySQL(client) => client.query(&sql).await,
Client::Http(client) => client.query(&sql).await,
Client::Clickhouse(client) => client.query(&sql).await,
}
}

pub fn enable_debug(&mut self) {
match self {
Client::MySQL(client) => client.debug = true,
Client::Http(client) => client.debug = true,
Client::Clickhouse(client) => client.debug = true,
}
}

Expand All @@ -84,7 +78,6 @@ impl Client {
match self {
Client::MySQL(_) => "mysql",
Client::Http(_) => "http",
Client::Clickhouse(_) => "clickhouse",
}
}
}
Expand Down
3 changes: 0 additions & 3 deletions tests/sqllogictests/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,6 @@ pub enum DSqlLogicTestError {
// Error from databend
#[error("Databend error: {0}")]
Databend(#[from] ErrorCode),
// ClickHouseClient Text Error
#[error("ClickHouse client error: {0}")]
ClickHouseClient(#[from] TextError),
// Error from mysql client
#[error("mysql client error: {0}")]
MysqlClient(#[from] MysqlClientError),
Expand Down
21 changes: 1 addition & 20 deletions tests/sqllogictests/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ use std::path::Path;
use std::time::Instant;

use clap::Parser;
use client::ClickhouseHttpClient;
use futures_util::stream;
use futures_util::StreamExt;
use sqllogictest::default_column_validator;
Expand Down Expand Up @@ -47,7 +46,6 @@ mod util;

const HANDLER_MYSQL: &str = "mysql";
const HANDLER_HTTP: &str = "http";
const HANDLER_CLICKHOUSE: &str = "clickhouse";

pub struct Databend {
client: Client,
Expand Down Expand Up @@ -79,7 +77,7 @@ pub async fn main() -> Result<()> {
let args = SqlLogicTestArgs::parse();
let handlers = match &args.handlers {
Some(hs) => hs.iter().map(|s| s.as_str()).collect(),
None => vec![HANDLER_MYSQL, HANDLER_HTTP, HANDLER_CLICKHOUSE],
None => vec![HANDLER_MYSQL, HANDLER_HTTP],
};
for handler in handlers.iter() {
match *handler {
Expand All @@ -89,9 +87,6 @@ pub async fn main() -> Result<()> {
HANDLER_HTTP => {
run_http_client().await?;
}
HANDLER_CLICKHOUSE => {
run_ck_http_client().await?;
}
_ => {
return Err(format!("Unknown test handler: {handler}").into());
}
Expand Down Expand Up @@ -123,17 +118,6 @@ async fn run_http_client() -> Result<()> {
Ok(())
}

async fn run_ck_http_client() -> Result<()> {
println!(
"Clickhouse http client starts to run with: {:?}",
SqlLogicTestArgs::parse()
);
let suits = SqlLogicTestArgs::parse().suites;
let suits = std::fs::read_dir(suits).unwrap();
run_suits(suits, ClientType::Clickhouse).await?;
Ok(())
}

// Create new databend with client type
async fn create_databend(client_type: &ClientType) -> Result<Databend> {
let mut client: Client;
Expand All @@ -149,9 +133,6 @@ async fn create_databend(client_type: &ClientType) -> Result<Databend> {
ClientType::Http => {
client = Client::Http(HttpClient::create()?);
}
ClientType::Clickhouse => {
client = Client::Clickhouse(ClickhouseHttpClient::create(&args.database)?);
}
}
if args.enable_sandbox {
client.create_sandbox().await?;
Expand Down
19 changes: 0 additions & 19 deletions tests/sqllogictests/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ use std::path::Path;
use std::path::PathBuf;

use clap::Parser;
use lazy_static::lazy_static;
use regex::Regex;
use regex::RegexBuilder;
use serde::Deserialize;
use serde::Serialize;
use serde_json::Value;
Expand All @@ -30,22 +27,6 @@ use crate::arg::SqlLogicTestArgs;
use crate::error::DSqlLogicTestError;
use crate::error::Result;

lazy_static! {
pub static ref SET_SQL_RE: Regex =
RegexBuilder::new(r"^SET\s+(?P<key>\w+)\s*=\s*[']?(?P<value>[^;[']]+)[']?\s*;?")
.case_insensitive(true)
.build()
.unwrap();
pub static ref UNSET_SQL_RE: Regex = RegexBuilder::new(r"^UNSET\s+(?P<key>\w+)\s*;?")
.case_insensitive(true)
.build()
.unwrap();
pub static ref USE_SQL_RE: Regex = RegexBuilder::new(r"^use\s+(?P<db>\w+)\s*;?")
.case_insensitive(true)
.build()
.unwrap();
}

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
pub struct HttpSessionConf {
pub database: Option<String>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ INSERT INTO t1 (id, var) VALUES(1, '{"a":')
statement error (?s)1046.*unable to cast type `Array\(UInt8\)` to type `Variant NULL`
INSERT INTO t1 (id, var) VALUES(1, [1,2,3])

skipif clickhouse

query IT
select * from t1 order by id asc
----
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ CREATE FILE FORMAT if not exists test_format TYPE=CSV
statement error 2509
CREATE FILE FORMAT test_format TYPE=CSV

skipif clickhouse

query TT
show FILE FORMATS;
----
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ SHOW STAGES
----
test_stage Internal 0 'root'@'%' (empty)

skipif clickhouse

query TTTTTITT
DESC STAGE test_stage
----
Expand Down
2 changes: 1 addition & 1 deletion tests/sqllogictests/suites/debug/select_0.test
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ select 1
----
1

skipif clickhouse

query I
select 1
----
Expand Down
2 changes: 1 addition & 1 deletion tests/sqllogictests/suites/debug/select_1.test
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ select 1
----
1

skipif clickhouse

query I
select 1
----
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ CREATE TABLE blobs (b TEXT, a BIGINT)
statement ok
INSERT INTO blobs VALUES('\xaa\xff\xaa',5), ('\xAA\xFF\xAA\xAA\xFF\xAA',30), ('\xAA\xFF\xAA\xAA\xFF\xAA\xAA\xFF\xAA',20)

skipif clickhouse

query TT
select arg_min(b,a), arg_max(b,a) from blobs
----
Expand Down
Loading