Skip to content

Commit 881c0e8

Browse files
authored
Merge branch 'main' into enable_experiment_aggregate
2 parents cb03c75 + c30bbf4 commit 881c0e8

126 files changed

Lines changed: 1367 additions & 1408 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

tests/shell_env.sh

Lines changed: 17 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -11,82 +11,66 @@ export QUERY_MYSQL_HANDLER_HOST=${QUERY_MYSQL_HANDLER_HOST:="127.0.0.1"}
1111
export QUERY_MYSQL_HANDLER_PORT=${QUERY_MYSQL_HANDLER_PORT:="3307"}
1212
export QUERY_HTTP_HANDLER_PORT=${QUERY_HTTP_HANDLER_PORT:="8000"}
1313

14-
bendsql_client() {
15-
local stderr_file status
16-
17-
stderr_file=$(mktemp) || return 1
18-
bendsql "$@" 2>"$stderr_file"
19-
status=$?
20-
sed -E 's/ \[v[0-9][^]]*\]$//' "$stderr_file" >&2
21-
rm -f "$stderr_file"
22-
return "$status"
23-
}
14+
export BENDSQL_ERROR_NO_VERSION=1
2415

25-
bendsql_query_http_connect() {
26-
bendsql_client \
16+
bendsql_connect() {
17+
bendsql \
2718
--host "${QUERY_MYSQL_HANDLER_HOST}" \
2819
--port "${QUERY_HTTP_HANDLER_PORT}" \
2920
"$@"
3021
}
3122

32-
bendsql_query_http_user_connect() {
23+
bendsql_connect_user() {
3324
local user="$1"
3425
local password="$2"
3526
shift 2
3627

37-
bendsql_query_http_connect \
28+
bendsql_connect \
3829
--user "${user}" \
3930
--password "${password}" \
4031
"$@"
4132
}
4233

43-
bendsql_client_connect() {
44-
bendsql_query_http_connect -uroot --quote-style=never "$@"
34+
bendsql_connect_root() {
35+
bendsql_connect -uroot --quote-style=never "$@"
4536
}
4637

47-
bendsql_client_output_null() {
48-
bendsql_client_connect --output null "$@"
38+
bendsql_connect_root_null() {
39+
bendsql_connect_root --output null "$@"
4940
}
5041

51-
export BENDSQL_CLIENT_CONNECT="bendsql_client_connect"
52-
export BENDSQL_CLIENT_OUTPUT_NULL="bendsql_client_output_null"
53-
54-
5542
# share client
5643
export QUERY_MYSQL_HANDLER_SHARE_PROVIDER_PORT="18000"
5744
export QUERY_MYSQL_HANDLER_SHARE_CONSUMER_PORT="28000"
5845

59-
bendsql_client_share_provider_connect() {
60-
bendsql_client \
46+
bendsql_connect_share_provider() {
47+
bendsql \
6148
-uroot \
6249
--host "${QUERY_MYSQL_HANDLER_HOST}" \
6350
--port "${QUERY_MYSQL_HANDLER_SHARE_PROVIDER_PORT}" \
6451
--quote-style=never \
6552
"$@"
6653
}
6754

68-
bendsql_client_share_consumer_connect() {
69-
bendsql_client \
55+
bendsql_connect_share_consumer() {
56+
bendsql \
7057
-uroot \
7158
--host "${QUERY_MYSQL_HANDLER_HOST}" \
7259
--port "${QUERY_MYSQL_HANDLER_SHARE_CONSUMER_PORT}" \
7360
--quote-style=never \
7461
"$@"
7562
}
7663

77-
export BENDSQL_CLIENT_PROVIDER_CONNECT="bendsql_client_share_provider_connect"
78-
export BENDSQL_CLIENT_CONSUMER_CONNECT="bendsql_client_share_consumer_connect"
79-
8064

8165
query() {
8266
echo ">>>> $1"
83-
echo "$1" | $BENDSQL_CLIENT_CONNECT
67+
echo "$1" | bendsql_connect_root
8468
echo "<<<<"
8569
}
8670

8771
stmt() {
8872
echo ">>>> $1"
89-
echo "$1" | $BENDSQL_CLIENT_CONNECT
73+
echo "$1" | bendsql_connect_root
9074
if [ $? -ne 0 ]; then
9175
echo "<<<<"
9276
fi
@@ -95,7 +79,7 @@ stmt() {
9579

9680
stmt_fail() {
9781
echo ">>>> $1"
98-
echo "$1" | $BENDSQL_CLIENT_CONNECT > /dev/null 2>&1
82+
echo "$1" | bendsql_connect_root > /dev/null 2>&1
9983
if [ $? -eq 0 ]; then
10084
return 1
10185
fi
@@ -109,7 +93,7 @@ comment() {
10993

11094
# Execute SQL as root user, useful for setup/teardown blocks
11195
run_root_sql() {
112-
cat <<SQL | $BENDSQL_CLIENT_CONNECT
96+
cat <<SQL | bendsql_connect_root
11397
$1
11498
SQL
11599
}

tests/sqllogictests/scripts/prepare_stage.sh

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,21 @@
77
# most of the time, the tests will succeed with with "s3" too.
88
# todo: add storage "http"?
99
DATADIR="fs://${PWD}/tests/data/"
10-
echo "drop stage if exists data" | $BENDSQL_CLIENT_CONNECT
11-
echo "create or replace connection my_conn_s3 storage_type = 's3' access_key_id ='minioadmin' secret_access_key ='minioadmin' endpoint_url='http://127.0.0.1:9900'" | $BENDSQL_CLIENT_CONNECT
12-
echo "create or replace stage data_s3 url='s3://testbucket/data/' connection=(connection_name='my_conn_s3') FILE_FORMAT = (type = PARQUET);" | $BENDSQL_CLIENT_CONNECT
13-
echo "create or replace stage data_fs url = '${DATADIR}' FILE_FORMAT = (type = PARQUET);" | $BENDSQL_CLIENT_CONNECT
10+
echo "drop stage if exists data" | bendsql_connect_root
11+
echo "create or replace connection my_conn_s3 storage_type = 's3' access_key_id ='minioadmin' secret_access_key ='minioadmin' endpoint_url='http://127.0.0.1:9900'" | bendsql_connect_root
12+
echo "create or replace stage data_s3 url='s3://testbucket/data/' connection=(connection_name='my_conn_s3') FILE_FORMAT = (type = PARQUET);" | bendsql_connect_root
13+
echo "create or replace stage data_fs url = '${DATADIR}' FILE_FORMAT = (type = PARQUET);" | bendsql_connect_root
1414
if [ -z "$TEST_STAGE_STORAGE" ] || [ "$TEST_STAGE_STORAGE" == "fs" ]; then
15-
echo "create or replace stage data url = '${DATADIR}' FILE_FORMAT = (type = PARQUET);" | $BENDSQL_CLIENT_CONNECT
15+
echo "create or replace stage data url = '${DATADIR}' FILE_FORMAT = (type = PARQUET);" | bendsql_connect_root
1616
elif [ "$TEST_STAGE_STORAGE" == "s3" ]; then
17-
echo "create or replace stage data url='s3://testbucket/data/' connection=(connection_name='my_conn_s3') FILE_FORMAT = (type = PARQUET);" | $BENDSQL_CLIENT_CONNECT
17+
echo "create or replace stage data url='s3://testbucket/data/' connection=(connection_name='my_conn_s3') FILE_FORMAT = (type = PARQUET);" | bendsql_connect_root
1818
else
1919
echo "unknown TEST_STAGE_STORAGE value: ${TEST_STAGE_STORAGE}"
2020
exit 1
2121
fi
2222

23-
echo "drop table if exists ontime" | $BENDSQL_CLIENT_CONNECT
24-
cat tests/data/ddl/ontime.sql | $BENDSQL_CLIENT_CONNECT
23+
echo "drop table if exists ontime" | bendsql_connect_root
24+
cat tests/data/ddl/ontime.sql | bendsql_connect_root
2525

2626
if [ -z "$TEST_STAGE_DEDUP" ] || [ "$TEST_STAGE_DEDUP" = "full_path" ]; then
2727
FULL_PATH=1
@@ -32,12 +32,12 @@ else
3232
exit 1
3333
fi
3434

35-
echo "set global copy_dedup_full_path_by_default = ${FULL_PATH}" | $BENDSQL_CLIENT_CONNECT
35+
echo "set global copy_dedup_full_path_by_default = ${FULL_PATH}" | bendsql_connect_root
3636

3737
if [ -z "$TEST_STAGE_SIZE" ] || [ "$TEST_STAGE_SIZE" = "small" ]; then
38-
echo "set global parquet_fast_read_bytes = 1048576" | $BENDSQL_CLIENT_CONNECT
38+
echo "set global parquet_fast_read_bytes = 1048576" | bendsql_connect_root
3939
elif [ "$TEST_STAGE_SIZE" = "large" ]; then
40-
echo "set global parquet_fast_read_bytes = 0" | $BENDSQL_CLIENT_CONNECT
40+
echo "set global parquet_fast_read_bytes = 0" | bendsql_connect_root
4141
else
4242
echo "TEST_STAGE_DEDUP must be 'small' or 'large'" >&2
4343
exit 1

tests/sqllogictests/scripts/prepare_tpcds_data.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@ tables=(
3636

3737
force=${2:-"1"}
3838
if [ "$force" == "0" ]; then
39-
table_exists=$(echo "SELECT COUNT() FROM system.tables WHERE database = '${db}' AND name = 'call_center'" | $BENDSQL_CLIENT_CONNECT --output tsv)
39+
table_exists=$(echo "SELECT COUNT() FROM system.tables WHERE database = '${db}' AND name = 'call_center'" | bendsql_connect_root --output tsv)
4040
table_exists=$(echo "$table_exists" | tr -d '\r\n[:space:]')
4141
if [ -n "$table_exists" ] && [ "$table_exists" -gt 0 ]; then
42-
res=$(echo "SELECT COUNT() from ${db}.call_center" | $BENDSQL_CLIENT_CONNECT --output tsv)
42+
res=$(echo "SELECT COUNT() from ${db}.call_center" | bendsql_connect_root --output tsv)
4343
res=$(echo "$res" | tr -d '\r\n[:space:]')
4444
if [ -n "$res" ] && [ "$res" -gt 0 ]; then
4545
echo "Table $db.call_center already exists and is not empty, size: ${res}. Use force=1 to override it."
@@ -48,11 +48,11 @@ if [ "$force" == "0" ]; then
4848
fi
4949
fi
5050

51-
echo "CREATE OR REPLACE DATABASE tpcds" | $BENDSQL_CLIENT_CONNECT
51+
echo "CREATE OR REPLACE DATABASE tpcds" | bendsql_connect_root
5252

5353
# Create Tables;
5454
# shellcheck disable=SC2002
55-
cat ${target_dir}/scripts/tpcds.sql | $BENDSQL_CLIENT_CONNECT
55+
cat ${target_dir}/scripts/tpcds.sql | bendsql_connect_root
5656
python ${target_dir}/scripts/prepare_duckdb_tpcds_data.py 1
5757

5858
stmt "drop stage if exists s1"

tests/sqllogictests/scripts/prepare_tpch_data.sh

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ db=${1:-"tpch_test"}
99
force=${2:-"1"}
1010

1111
if [ "$force" == "0" ]; then
12-
table_exists=$(echo "SELECT COUNT() FROM system.tables WHERE database = '${db}' AND name = 'nation'" | $BENDSQL_CLIENT_CONNECT --output tsv)
12+
table_exists=$(echo "SELECT COUNT() FROM system.tables WHERE database = '${db}' AND name = 'nation'" | bendsql_connect_root --output tsv)
1313
table_exists=$(echo "$table_exists" | tr -d '\r\n[:space:]')
1414
if [ -n "$table_exists" ] && [ "$table_exists" -gt 0 ]; then
15-
res=$(echo "SELECT COUNT() from ${db}.nation" | $BENDSQL_CLIENT_CONNECT --output tsv)
15+
res=$(echo "SELECT COUNT() from ${db}.nation" | bendsql_connect_root --output tsv)
1616
res=$(echo "$res" | tr -d '\r\n[:space:]')
1717
if [ -n "$res" ] && [ "$res" -gt 0 ]; then
1818
echo "Table $db.nation already exists and is not empty, size: ${res}. Use force=1 to override it."
@@ -21,11 +21,11 @@ if [ "$force" == "0" ]; then
2121
fi
2222
fi
2323

24-
echo "DROP DATABASE if EXISTS ${db}" | $BENDSQL_CLIENT_CONNECT
25-
echo "CREATE DATABASE ${db}" | $BENDSQL_CLIENT_CONNECT
24+
echo "DROP DATABASE if EXISTS ${db}" | bendsql_connect_root
25+
echo "CREATE DATABASE ${db}" | bendsql_connect_root
2626

2727
for t in customer lineitem nation orders partsupp part region supplier; do
28-
echo "DROP TABLE IF EXISTS ${db}.$t" | $BENDSQL_CLIENT_CONNECT
28+
echo "DROP TABLE IF EXISTS ${db}.$t" | bendsql_connect_root
2929
done
3030

3131
# create tpch tables
@@ -35,14 +35,14 @@ echo "CREATE TABLE IF NOT EXISTS ${db}.nation
3535
n_name STRING not null,
3636
n_regionkey INTEGER not null,
3737
n_comment STRING
38-
) CLUSTER BY (n_nationkey)" | $BENDSQL_CLIENT_CONNECT
38+
) CLUSTER BY (n_nationkey)" | bendsql_connect_root
3939

4040
echo "CREATE TABLE IF NOT EXISTS ${db}.region
4141
(
4242
r_regionkey INTEGER not null,
4343
r_name STRING not null,
4444
r_comment STRING
45-
) CLUSTER BY (r_regionkey)" | $BENDSQL_CLIENT_CONNECT
45+
) CLUSTER BY (r_regionkey)" | bendsql_connect_root
4646

4747
echo "CREATE TABLE IF NOT EXISTS ${db}.part
4848
(
@@ -55,7 +55,7 @@ echo "CREATE TABLE IF NOT EXISTS ${db}.part
5555
p_container STRING not null,
5656
p_retailprice DECIMAL(15, 2) not null,
5757
p_comment STRING not null
58-
) CLUSTER BY (p_partkey)" | $BENDSQL_CLIENT_CONNECT
58+
) CLUSTER BY (p_partkey)" | bendsql_connect_root
5959

6060
echo "CREATE TABLE IF NOT EXISTS ${db}.supplier
6161
(
@@ -66,7 +66,7 @@ echo "CREATE TABLE IF NOT EXISTS ${db}.supplier
6666
s_phone STRING not null,
6767
s_acctbal DECIMAL(15, 2) not null,
6868
s_comment STRING not null
69-
) CLUSTER BY (s_suppkey)" | $BENDSQL_CLIENT_CONNECT
69+
) CLUSTER BY (s_suppkey)" | bendsql_connect_root
7070

7171
echo "CREATE TABLE IF NOT EXISTS ${db}.partsupp
7272
(
@@ -75,7 +75,7 @@ echo "CREATE TABLE IF NOT EXISTS ${db}.partsupp
7575
ps_availqty BIGINT not null,
7676
ps_supplycost DECIMAL(15, 2) not null,
7777
ps_comment STRING not null
78-
) CLUSTER BY (ps_partkey)" | $BENDSQL_CLIENT_CONNECT
78+
) CLUSTER BY (ps_partkey)" | bendsql_connect_root
7979

8080
echo "CREATE TABLE IF NOT EXISTS ${db}.customer
8181
(
@@ -87,7 +87,7 @@ echo "CREATE TABLE IF NOT EXISTS ${db}.customer
8787
c_acctbal DECIMAL(15, 2) not null,
8888
c_mktsegment STRING not null,
8989
c_comment STRING not null
90-
) CLUSTER BY (c_custkey)" | $BENDSQL_CLIENT_CONNECT
90+
) CLUSTER BY (c_custkey)" | bendsql_connect_root
9191

9292
echo "CREATE TABLE IF NOT EXISTS ${db}.orders
9393
(
@@ -100,7 +100,7 @@ echo "CREATE TABLE IF NOT EXISTS ${db}.orders
100100
o_clerk STRING not null,
101101
o_shippriority INTEGER not null,
102102
o_comment STRING not null
103-
) CLUSTER BY (o_orderkey, o_orderdate)" | $BENDSQL_CLIENT_CONNECT
103+
) CLUSTER BY (o_orderkey, o_orderdate)" | bendsql_connect_root
104104

105105
echo "CREATE TABLE IF NOT EXISTS ${db}.lineitem
106106
(
@@ -120,7 +120,7 @@ echo "CREATE TABLE IF NOT EXISTS ${db}.lineitem
120120
l_shipinstruct STRING not null,
121121
l_shipmode STRING not null,
122122
l_comment STRING not null
123-
) CLUSTER BY(l_shipdate, l_orderkey)" | $BENDSQL_CLIENT_CONNECT
123+
) CLUSTER BY(l_shipdate, l_orderkey)" | bendsql_connect_root
124124

125125
#import data
126126
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)

tests/suites/0_stateless/00_dummy/00_0003_dummy_select_sh.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
44
. "$CURDIR"/../../../shell_env.sh
55

66

7-
echo "SELECT 1;select 2;select 3;" | $BENDSQL_CLIENT_CONNECT
7+
echo "SELECT 1;select 2;select 3;" | bendsql_connect_root
88

9-
echo "SELECT 1" | $BENDSQL_CLIENT_CONNECT
10-
echo "SELECT 2" | $BENDSQL_CLIENT_CONNECT
11-
echo "SELECT 3" | $BENDSQL_CLIENT_CONNECT
9+
echo "SELECT 1" | bendsql_connect_root
10+
echo "SELECT 2" | bendsql_connect_root
11+
echo "SELECT 3" | bendsql_connect_root

tests/suites/0_stateless/02_ddl/02_0001_autoincrement.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
44
. "$CURDIR"/../../../shell_env.sh
55

6-
echo "create or replace database test" | $BENDSQL_CLIENT_CONNECT
6+
echo "create or replace database test" | bendsql_connect_root
77

88

99
stmt """

tests/suites/0_stateless/02_ddl/02_0001_show_create_table.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
44
. "$CURDIR"/../../../shell_env.sh
55

6-
echo "create or replace database test" | $BENDSQL_CLIENT_CONNECT
6+
echo "create or replace database test" | bendsql_connect_root
77

88

99
stmt """
@@ -37,7 +37,7 @@ and t.name = 'b'
3737
echo """
3838
set hide_options_in_show_create_table=0;
3939
SHOW CREATE TABLE test.b;
40-
""" | $BENDSQL_CLIENT_CONNECT
40+
""" | bendsql_connect_root
4141

4242
stmt "create or replace view test.v_b as select * from test.b"
4343

@@ -60,7 +60,7 @@ query "SHOW CREATE TABLE test.c"
6060
echo """
6161
create or replace table test.t(c1 int, c2 int);
6262
create or replace table test.t1(c1 int, c2 string);
63-
""" | $BENDSQL_CLIENT_CONNECT
63+
""" | bendsql_connect_root
6464

6565
stmt "create or replace view test.v_union as select c1 from test.t union all select c1 from test.t1;"
6666

@@ -87,7 +87,7 @@ show create table test.tc;
8787
set quoted_ident_case_sensitive=1;
8888
set sql_dialect='MySQL';
8989
show create table test.tc;
90-
""" | $BENDSQL_CLIENT_CONNECT
90+
""" | bendsql_connect_root
9191

9292
stmt """
9393
create or replace table test.auto_increment(c1 int, c2 int autoincrement, c3 int identity (2, 3) order);

tests/suites/0_stateless/03_dml/03_0016_update_with_lock.sh

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,32 +3,32 @@
33
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
44
. "$CURDIR"/../../../shell_env.sh
55

6-
echo "drop database if exists test_update" | $BENDSQL_CLIENT_CONNECT
6+
echo "drop database if exists test_update" | bendsql_connect_root
77

8-
echo "CREATE DATABASE test_update" | $BENDSQL_CLIENT_CONNECT
9-
echo "create table test_update.t(a int, b int)" | $BENDSQL_CLIENT_CONNECT
10-
echo "set global enable_table_lock = 1" | $BENDSQL_CLIENT_CONNECT
8+
echo "CREATE DATABASE test_update" | bendsql_connect_root
9+
echo "create table test_update.t(a int, b int)" | bendsql_connect_root
10+
echo "set global enable_table_lock = 1" | bendsql_connect_root
1111

1212
for i in $(seq 1 10);do
1313
(
1414
j=$(($i+1))
15-
echo "insert into test_update.t values($i, $j)" | $BENDSQL_CLIENT_OUTPUT_NULL
15+
echo "insert into test_update.t values($i, $j)" | bendsql_connect_root_null
1616
)&
1717
done
1818
wait
1919

20-
echo "optimize table test_update.t compact" | $BENDSQL_CLIENT_CONNECT
21-
echo "select count() from test_update.t where a + 1 = b" | $BENDSQL_CLIENT_CONNECT
20+
echo "optimize table test_update.t compact" | bendsql_connect_root
21+
echo "select count() from test_update.t where a + 1 = b" | bendsql_connect_root
2222

2323
echo "Test table lock for update"
2424
for i in $(seq 1 10);do
2525
(
26-
echo "update test_update.t set b = $i where a = $i" | $BENDSQL_CLIENT_OUTPUT_NULL
26+
echo "update test_update.t set b = $i where a = $i" | bendsql_connect_root_null
2727
)&
2828
done
2929
wait
3030

31-
echo "select count() from test_update.t where a = b" | $BENDSQL_CLIENT_CONNECT
31+
echo "select count() from test_update.t where a = b" | bendsql_connect_root
3232

33-
echo "drop table test_update.t all" | $BENDSQL_CLIENT_CONNECT
34-
echo "drop database test_update" | $BENDSQL_CLIENT_CONNECT
33+
echo "drop table test_update.t all" | bendsql_connect_root
34+
echo "drop database test_update" | bendsql_connect_root

0 commit comments

Comments
 (0)