Skip to content
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

query(tests): improve tests #4720

Merged
merged 2 commits into from
Apr 6, 2022
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
Original file line number Diff line number Diff line change
Expand Up @@ -161,3 +161,5 @@
1
1
1 1 1 1
2022-04-02 15:10:28 2022-04-02 15:10:28.000
2022-04-02 15:10:28 2022-04-02 15:10:28.221
Original file line number Diff line number Diff line change
Expand Up @@ -197,3 +197,11 @@ insert into ts values(now(), now(), today(), today());
select toDateTime64(a) = toDateTime64(b), toDateTime32(a) = toDateTime(b), toDate32(c) = toDate32(d), toDate(c) = toDate(d) from ts;
drop table if exists ts;


create table t(d32 datetime32, d64 datetime64);

insert into t values('2022-04-02 15:10:28', '2022-04-02 15:10:28');
insert into t values('2022-04-02 15:10:28.221', '2022-04-02 15:10:28.221');

select * from t order by d64;
drop table t;
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,3 @@ Test copy from file
398 2020 1538
398 2020 1538
398 2020 1538
ontime_200.csv
ontime_200.parquet
199 2020 769
ontime_200.parquet
ontime_200_v1.parquet
398 2020 1538
25 changes: 1 addition & 24 deletions tests/suites/1_stateful/00_copy/00_0000_copy_from_s3_location.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,29 +36,6 @@ echo "truncate table ontime200" | $MYSQL_CLIENT_CONNECT
echo "copy into ontime200 from 's3://testbucket/admin/data/' credentials=(aws_key_id='minioadmin' aws_secret_key='minioadmin') PATTERN = 'ontime.*parquet' FILE_FORMAT = (type = 'PARQUET')" | $MYSQL_CLIENT_CONNECT
echo "select count(1), avg(Year), sum(DayOfWeek) from ontime200" | $MYSQL_CLIENT_CONNECT
echo "truncate table ontime200" | $MYSQL_CLIENT_CONNECT
echo "drop table if exists ontime200;" | $MYSQL_CLIENT_CONNECT



aws --endpoint-url http://127.0.0.1:9900/ s3 cp s3://testbucket/admin/data/ontime_200.csv s3://testbucket/admin/stage/s1/ontime_200.csv > /dev/null 2>&1
aws --endpoint-url http://127.0.0.1:9900/ s3 cp s3://testbucket/admin/data/ontime_200.parquet s3://testbucket/admin/stage/s1/ontime_200.parquet > /dev/null 2>&1


echo "CREATE STAGE s1;" | $MYSQL_CLIENT_CONNECT
echo "list @s1 PATTERN = 'ontime.*'" | $MYSQL_CLIENT_CONNECT
echo "copy into ontime200 from '@s1' PATTERN = 'ontime.*parquet' FILE_FORMAT = (type = 'PARQUET');" | $MYSQL_CLIENT_CONNECT
echo "select count(1), avg(Year), sum(DayOfWeek) from ontime200" | $MYSQL_CLIENT_CONNECT
echo "truncate table ontime200" | $MYSQL_CLIENT_CONNECT


## Copy from named external stage
echo "CREATE STAGE named_external_stage url = 's3://testbucket/admin/data/' credentials=(aws_key_id='minioadmin' aws_secret_key='minioadmin');" | $MYSQL_CLIENT_CONNECT
echo "list @named_external_stage PATTERN = 'ontime.*parquet'" | $MYSQL_CLIENT_CONNECT
echo "copy into ontime200 from '@named_external_stage' PATTERN = 'ontime.*parquet' FILE_FORMAT = (type = 'PARQUET')" | $MYSQL_CLIENT_CONNECT
echo "select count(1), avg(Year), sum(DayOfWeek) from ontime200" | $MYSQL_CLIENT_CONNECT
echo "truncate table ontime200" | $MYSQL_CLIENT_CONNECT


## Drop table.
echo "drop table ontime200" | $MYSQL_CLIENT_CONNECT
echo "drop stage if exists named_external_stage" | $MYSQL_CLIENT_CONNECT
echo "drop stage if exists s1" | $MYSQL_CLIENT_CONNECT
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
ontime_200.csv
ontime_200.parquet
199 2020 769
ontime_200.parquet
ontime_200_v1.parquet
398 2020 1538
34 changes: 34 additions & 0 deletions tests/suites/1_stateful/00_copy/00_0000_copy_from_stage.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/usr/bin/env bash

CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
. "$CURDIR"/../../../shell_env.sh

echo "drop table if exists ontime200;" | $MYSQL_CLIENT_CONNECT
## Create table
cat $CURDIR/../ontime/create_table.sql | sed 's/ontime/ontime200/g' | $MYSQL_CLIENT_CONNECT


aws --endpoint-url http://127.0.0.1:9900/ s3 cp s3://testbucket/admin/data/ontime_200.csv s3://testbucket/admin/stage/s1/ontime_200.csv > /dev/null 2>&1
aws --endpoint-url http://127.0.0.1:9900/ s3 cp s3://testbucket/admin/data/ontime_200.parquet s3://testbucket/admin/stage/s1/ontime_200.parquet > /dev/null 2>&1


echo "CREATE STAGE s1;" | $MYSQL_CLIENT_CONNECT
echo "list @s1 PATTERN = 'ontime.*'" | $MYSQL_CLIENT_CONNECT
echo "copy into ontime200 from '@s1' PATTERN = 'ontime.*parquet' FILE_FORMAT = (type = 'PARQUET');" | $MYSQL_CLIENT_CONNECT
echo "select count(1), avg(Year), sum(DayOfWeek) from ontime200" | $MYSQL_CLIENT_CONNECT
echo "truncate table ontime200" | $MYSQL_CLIENT_CONNECT


## Copy from named external stage
echo "CREATE STAGE named_external_stage url = 's3://testbucket/admin/data/' credentials=(aws_key_id='minioadmin' aws_secret_key='minioadmin');" | $MYSQL_CLIENT_CONNECT
echo "list @named_external_stage PATTERN = 'ontime.*parquet'" | $MYSQL_CLIENT_CONNECT
echo "copy into ontime200 from '@named_external_stage' PATTERN = 'ontime.*parquet' FILE_FORMAT = (type = 'PARQUET')" | $MYSQL_CLIENT_CONNECT
echo "select count(1), avg(Year), sum(DayOfWeek) from ontime200" | $MYSQL_CLIENT_CONNECT
echo "truncate table ontime200" | $MYSQL_CLIENT_CONNECT


## Drop table.
echo "drop table ontime200" | $MYSQL_CLIENT_CONNECT
echo "drop stage if exists named_external_stage" | $MYSQL_CLIENT_CONNECT
echo "drop stage if exists s1" | $MYSQL_CLIENT_CONNECT