diff --git a/ci/scripts/e2e-cassandra-sink-test.sh b/ci/scripts/e2e-cassandra-sink-test.sh index 41ff0e97190d0..b74c2be83d5d1 100755 --- a/ci/scripts/e2e-cassandra-sink-test.sh +++ b/ci/scripts/e2e-cassandra-sink-test.sh @@ -51,12 +51,15 @@ export CQLSH_PORT=9042 ./cqlsh --request-timeout=20 -e "CREATE KEYSPACE demo WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1};use demo; CREATE table demo_bhv_table(v1 int primary key,v2 smallint,v3 bigint,v4 float,v5 double,v6 text,v7 date,v8 timestamp,v9 boolean);" +./cqlsh --request-timeout=20 -e "CREATE table test_uppercase(\"TEST_V1\" int primary key, \"TEST_V2\" int,\"TEST_V3\" int);" + echo "--- testing sinks" cd ../../ sqllogictest -p 4566 -d dev './e2e_test/sink/cassandra_sink.slt' sleep 1 cd apache-cassandra-4.1.3/bin ./cqlsh --request-timeout=20 -e "COPY demo.demo_bhv_table TO './query_result.csv' WITH HEADER = false AND ENCODING = 'UTF-8';" +./cqlsh --request-timeout=20 -e "COPY demo.test_uppercase TO './query_result2.csv' WITH HEADER = false AND ENCODING = 'UTF-8';" if cat ./query_result.csv | awk -F "," '{ exit !($1 == 1 && $2 == 1 && $3 == 1 && $4 == 1.1 && $5 == 1.2 && $6 == "test" && $7 == "2013-01-01" && $8 == "2013-01-01 01:01:01.000+0000" && $9 == "False\r"); }'; then @@ -68,6 +71,16 @@ else exit 1 fi +if cat ./query_result2.csv | awk -F "," '{ + exit !($1 == 1 && $2 == 1 && $3 == 1); }'; then + echo "Cassandra sink check passed" +else + echo "The output is not as expected." + echo "output:" + cat ./query_result.csv + exit 1 +fi + echo "--- Kill cluster" cd ../../ risedev ci-kill \ No newline at end of file diff --git a/e2e_test/sink/cassandra_sink.slt b/e2e_test/sink/cassandra_sink.slt index 7091e8da70783..f98ee45610534 100644 --- a/e2e_test/sink/cassandra_sink.slt +++ b/e2e_test/sink/cassandra_sink.slt @@ -23,6 +23,28 @@ INSERT INTO t6 VALUES (1, 1, 1, 1.1, 1.2, 'test', '2013-01-01', '2013-01-01 01:0 statement ok FLUSH; +statement ok +CREATE TABLE t7 ("TEST_V1" int primary key, "TEST_V1" int, "TEST_V1" int); + +statement ok +CREATE SINK s7 +FROM + test_uppercase WITH ( + connector = 'cassandra', + type = 'append-only', + force_append_only='true', + cassandra.url = 'cassandra-server:9042', + cassandra.keyspace = 'demo', + cassandra.table = 'test_uppercase', + cassandra.datacenter = 'datacenter1', +); + +statement ok +INSERT INTO t7 VALUES (1, 1, 1); + +statement ok +FLUSH; + statement ok DROP SINK s6; @@ -30,4 +52,10 @@ statement ok DROP MATERIALIZED VIEW mv6; statement ok -DROP TABLE t6; \ No newline at end of file +DROP TABLE t6; + +statement ok +DROP SINK s7; + +statement ok +DROP TABLE t7; \ No newline at end of file