diff --git a/ci/scripts/e2e-clickhouse-sink-test.sh b/ci/scripts/e2e-clickhouse-sink-test.sh index 74a899b01422c..e9f131ce4f5bc 100755 --- a/ci/scripts/e2e-clickhouse-sink-test.sh +++ b/ci/scripts/e2e-clickhouse-sink-test.sh @@ -59,11 +59,11 @@ else fi echo "--- testing sinks upsert1" -./clickhouse client --host=clickhouse-server --port=9000 --query="select * from demo_test_upsert1 FORMAT CSV final;" > ./query_result2.csv +./clickhouse client --host=clickhouse-server --port=9000 --query="select * from demo_test_upsert1 final FORMAT CSV;" > ./query_result2.csv if cat ./query_result2.csv | sort | awk -F "," '{ - if ($1 == 2 && $2 == 2 && $3 == "\"2-2\"" && $4 == "2013-01-02 01:01:02+01:00" && $4 == 0) c2++; - if ($1 == 3 && $2 == 2 && $3 == "\"3-2\"" && $4 == "2013-01-03 01:01:02+01:00" && $4 == 0) c3++; + if ($1 == 2 && $2 == 2 && $3 == "\"2-2\"" && $4 == "\"2013-01-02 00:01:02.000\"" && $4 == 0) c2++; + if ($1 == 3 && $2 == 2 && $3 == "\"3-2\"" && $4 == "\"2013-01-03 00:01:02.000\"" && $4 == 0) c3++; END { exit !(c2 == 1 && c3 == 1); }'; then echo "Clickhouse sink check passed" else @@ -73,7 +73,7 @@ else fi echo "--- testing sinks upsert2" -./clickhouse client --host=clickhouse-server --port=9000 --query="select * from demo_test_upsert2 FORMAT CSV final;" > ./query_result3.csv +./clickhouse client --host=clickhouse-server --port=9000 --query="select * from demo_test_upsert2 final FORMAT CSV;" > ./query_result3.csv if cat ./query_result2.csv | sort | awk -F "," '{ if ($1 == 2 && $2 == 2 && $3 == "\"2-2\"" && $3 == 1) c2++; diff --git a/e2e_test/sink/clickhouse_sink.slt b/e2e_test/sink/clickhouse_sink.slt index c9eb2ae83cb4f..8c19558774ee9 100644 --- a/e2e_test/sink/clickhouse_sink.slt +++ b/e2e_test/sink/clickhouse_sink.slt @@ -16,7 +16,7 @@ CREATE SINK s6 from t6 WITH ( connector = 'clickhouse', type = 'append-only', force_append_only='true', - clickhouse.url = 'http://127.0.0.1:8123', + clickhouse.url = 'http://clickhouse-server:8123', clickhouse.user = 'default', clickhouse.password = '', clickhouse.database = 'default', @@ -26,13 +26,15 @@ CREATE SINK s6 from t6 WITH ( statement ok INSERT INTO t6 VALUES (1, 50, '1-50', 1, 1.1), (2, 2, '2-2', 2, 2.2), (3, 2, '3-2', 1, 3.3), (5, 2, '5-2', 2, 4.4), (8, 2, '8-2', 1, 'inf'), (13, 2, '13-2', 2, '-inf'), (21, 2, '21-2', 1, 'nan'); +statement ok +FLUSH; statement ok CREATE SINK s7 from t7 WITH ( connector = 'clickhouse', type = 'upsert', primary_key = 'v1', - clickhouse.url = 'http://127.0.0.1:8123', + clickhouse.url = 'http://clickhouse-server:8123', clickhouse.user = 'default', clickhouse.password = '', clickhouse.database = 'default', @@ -43,15 +45,21 @@ CREATE SINK s7 from t7 WITH ( statement ok INSERT INTO t7 VALUES (1, 50, '1-50', '2013-01-01 01:01:02+01:00'), (2, 2, '2-2', '2013-01-02 01:01:02+01:00'), (3, 2, '3-2','2013-01-03 01:01:02+01:00'); +statement ok +FLUSH; + statement ok delete from t7 where v1 = 1; +statement ok +FLUSH; + statement ok CREATE SINK s8 from t8 WITH ( connector = 'clickhouse', type = 'upsert', primary_key = 'v1', - clickhouse.url = 'http://127.0.0.1:8123', + clickhouse.url = 'http://clickhouse-server:8123', clickhouse.user = 'default', clickhouse.password = '', clickhouse.database = 'default', @@ -62,6 +70,9 @@ CREATE SINK s8 from t8 WITH ( statement ok INSERT INTO t8 VALUES (1, 50, '1-50'), (2, 2, '2-2'), (3, 2, '3-2'); +statement ok +FLUSH; + statement ok delete from t8 where v1 = 1;