Skip to content

Commit 5581d25

Browse files
authored
chore: refine copy into tests (#17413)
* test(stage): decouple `COPY INTO` tests from output data byte size The tests should not assert the exact byte size of data outputs, as this value may change across different versions of `databend-query` due to meta data of data block contains the version the `databend-query`, which is variant lengthed. This change replaces byte size checks with content validation, ensuring test stability while maintaining functional correctness. * test(stage): decouple `COPY INTO` tests from output data byte size * test(stage): decouple `COPY INTO` tests from output data byte size * test(stage): decouple `COPY INTO` tests from output data byte size * test(stage): decouple `COPY INTO` tests from output data byte size * test(stage): decouple `COPY INTO` tests from output data byte size * test(stage): decouple `COPY INTO` tests from output data byte size * test(stage): decouple `COPY INTO` tests from output data byte size 05_0001_set_var.sh * test(stage): decouple `COPY INTO` tests from output data byte size 18_0002_ownership_cover * decouple `COPY INTO` tests from output data byte size 18_0007_privilege_access * decouple `COPY INTO` tests from output data byte size 20_0015_compact_hook_stas_issue_13947 * decouple `COPY INTO` tests from output data byte size * revert scripts/ci/deploy/config/databend-query-node-1.toml
1 parent ce3a170 commit 5581d25

24 files changed

+81
-68
lines changed

tests/sqllogictests/suites/stage/formats/parquet/options/null_if.test

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,15 @@ insert into string values (''), ('null'),('128')
2323
statement ok
2424
remove @data/unload/parquet/null_if/
2525

26-
query
26+
statement ok
2727
copy into @data/unload/parquet/null_if from string
28+
29+
query
30+
select a from @data/unload/parquet/null_if order by a
2831
----
29-
3 56 387
32+
(empty)
33+
128
34+
null
3035

3136
statement ok
3237
drop file format if exists parquet_null_if

tests/sqllogictests/suites/stage/formats/parquet/options/parquet_missing_uuid.test

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,13 @@ create table t_uuid(id string default uuid(), a int)
77
statement ok
88
remove @data/parquet/unload/uuid
99

10-
query
10+
statement ok
1111
copy into @data/parquet/unload/uuid/ from (select 1 as a) file_format = (type = parquet)
12+
13+
query
14+
select a from @data/parquet/unload/uuid/
1215
----
13-
1 1 374
16+
1
1417

1518
query error column id doesn't exist
1619
copy into t_uuid from @data/parquet/unload/uuid file_format = (type = parquet) RETURN_FAILED_ONLY=TRUE

tests/suites/0_stateless/05_hints/05_0001_set_var.result

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,5 @@ America/Toronto
2323
1
2424
2022-02-02 03:00:00
2525
2022-02-02 03:00:00
26-
1 13 427
26+
1 13
2727
Asia/Shanghai

tests/suites/0_stateless/05_hints/05_0001_set_var.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,6 @@ echo "set timezone='America/Toronto'; insert /*+SET_VAR(timezone='Asia/Shanghai'
3535
echo "drop database set_var;" | $BENDSQL_CLIENT_CONNECT
3636
echo "drop stage if exists s2" | $BENDSQL_CLIENT_CONNECT
3737
echo "create stage s2" | $BENDSQL_CLIENT_CONNECT
38-
echo "copy /*+SET_VAR(timezone='Asia/Shanghai') */ into @s2 from (select timezone()); " | $BENDSQL_CLIENT_CONNECT
38+
echo "copy /*+SET_VAR(timezone='Asia/Shanghai') */ into @s2 from (select timezone()); " | $BENDSQL_CLIENT_CONNECT | cut -d$'\t' -f1,2
3939
echo "select * from @s2 " | $BENDSQL_CLIENT_CONNECT
4040
echo "drop stage s2" | $BENDSQL_CLIENT_CONNECT

tests/suites/0_stateless/18_rbac/18_0002_ownership_cover.result

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
1
33
200
44
=== test stage ===
5-
1 8 400
5+
1 8
66
0
77
=== test udf ===
88
2

tests/suites/0_stateless/18_rbac/18_0002_ownership_cover.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ echo "select * from d_0002.t" | $TEST_USER_CONNECT
4141
## stage
4242
echo "=== test stage ==="
4343
echo 'create stage hello' | $TEST_USER_CONNECT
44-
echo 'COPY INTO @hello from (select number from numbers(1)) FILE_FORMAT = (type = parquet)' | $TEST_USER_CONNECT
44+
echo 'COPY INTO @hello from (select number from numbers(1)) FILE_FORMAT = (type = parquet)' | $TEST_USER_CONNECT | cut -d$'\t' -f1,2
4545
echo 'select * from @hello' | $TEST_USER_CONNECT
4646

4747
## udf

tests/suites/0_stateless/18_rbac/18_0007_privilege_access.result

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ Error: APIError: QueryFailed: [1063]Permission denied: privilege READ is require
101101
Error: APIError: QueryFailed: [1063]Permission denied: No privilege on database root_db for user b.
102102
Error: APIError: QueryFailed: [1063]Permission denied: No privilege on table root_table for user b.
103103
Error: APIError: QueryFailed: [1063]Permission denied: No privilege on table root_table for user b.
104-
1 1 374
104+
1 1
105105
Error: APIError: QueryFailed: [1063]Permission denied: privilege [Select] is required on 'default'.'default'.'t1' for user 'b'@'%' with roles [public]
106106
Error: APIError: QueryFailed: [1063]Permission denied: privilege [Read] is required on STAGE s3 for user 'b'@'%' with roles [public]. Note: Please ensure that your current role have the appropriate permissions to create a new Warehouse|Database|Table|UDF|Stage.
107107
Error: APIError: QueryFailed: [1063]Permission denied: privilege [Select] is required on 'default'.'default'.'t' for user 'b'@'%' with roles [public]

tests/suites/0_stateless/18_rbac/18_0007_privilege_access.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ echo "grant insert, delete on default.t to b" | $BENDSQL_CLIENT_CONNECT
236236
echo "grant select on system.* to b" | $BENDSQL_CLIENT_CONNECT
237237

238238
echo "create stage s3;" | $BENDSQL_CLIENT_CONNECT
239-
echo "copy into '@s3/a b' from (select 2);" | $BENDSQL_CLIENT_CONNECT | $RM_UUID
239+
echo "copy into '@s3/a b' from (select 2);" | $BENDSQL_CLIENT_CONNECT | $RM_UUID | cut -d$'\t' -f1,2
240240

241241
# need err
242242
echo "insert into t select * from t1" | $USER_B_CONNECT

tests/suites/0_stateless/20+_others/20_0015_compact_hook_stas_issue_13947.result

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
1
2-
1
3-
2 10 399
41
expects .stats.write_progress.rows be 2
52
expects .error be null
63
2

tests/suites/0_stateless/20+_others/20_0015_compact_hook_stas_issue_13947.sh

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

66
# set up
7-
cat <<EOF | $BENDSQL_CLIENT_CONNECT
7+
cat <<EOF | $BENDSQL_CLIENT_CONNECT > /dev/null
88
create or replace database i13947;
99
use i13947;
1010
create or replace stage test_stage;

0 commit comments

Comments
 (0)