diff --git a/tests/suites/0_stateless/02_function/02_0012_function_datetimes.result b/tests/suites/0_stateless/02_function/02_0012_function_datetimes.result index b03c7055d6bf..10f7360819c7 100644 --- a/tests/suites/0_stateless/02_function/02_0012_function_datetimes.result +++ b/tests/suites/0_stateless/02_function/02_0012_function_datetimes.result @@ -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 diff --git a/tests/suites/0_stateless/02_function/02_0012_function_datetimes.sql b/tests/suites/0_stateless/02_function/02_0012_function_datetimes.sql index 828b9b34595e..ea22a80d1b07 100644 --- a/tests/suites/0_stateless/02_function/02_0012_function_datetimes.sql +++ b/tests/suites/0_stateless/02_function/02_0012_function_datetimes.sql @@ -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; diff --git a/tests/suites/1_stateful/00_copy/00_0000_copy_from_s3_location.result b/tests/suites/1_stateful/00_copy/00_0000_copy_from_s3_location.result index 3821af3bf5f9..78dcf86a42b8 100644 --- a/tests/suites/1_stateful/00_copy/00_0000_copy_from_s3_location.result +++ b/tests/suites/1_stateful/00_copy/00_0000_copy_from_s3_location.result @@ -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 diff --git a/tests/suites/1_stateful/00_copy/00_0000_copy_from_s3_location.sh b/tests/suites/1_stateful/00_copy/00_0000_copy_from_s3_location.sh index 49113b620ca6..f89251c34993 100755 --- a/tests/suites/1_stateful/00_copy/00_0000_copy_from_s3_location.sh +++ b/tests/suites/1_stateful/00_copy/00_0000_copy_from_s3_location.sh @@ -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 diff --git a/tests/suites/1_stateful/00_copy/00_0000_copy_from_stage.result b/tests/suites/1_stateful/00_copy/00_0000_copy_from_stage.result new file mode 100755 index 000000000000..d1fc7d7ed41f --- /dev/null +++ b/tests/suites/1_stateful/00_copy/00_0000_copy_from_stage.result @@ -0,0 +1,6 @@ +ontime_200.csv +ontime_200.parquet +199 2020 769 +ontime_200.parquet +ontime_200_v1.parquet +398 2020 1538 diff --git a/tests/suites/1_stateful/00_copy/00_0000_copy_from_stage.sh b/tests/suites/1_stateful/00_copy/00_0000_copy_from_stage.sh new file mode 100755 index 000000000000..9a09adf7a998 --- /dev/null +++ b/tests/suites/1_stateful/00_copy/00_0000_copy_from_stage.sh @@ -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 +