You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
query "DROP TABLE IF EXISTS $rmt_table, $s3_table, $rmt_table_roundtrip"
17
+
18
+
query "CREATE TABLE $rmt_table (id UInt64, year UInt16) ENGINE = ReplicatedMergeTree('/clickhouse/tables/{database}/$rmt_table', 'replica1') PARTITION BY year ORDER BY tuple()"
19
+
query "CREATE TABLE $s3_table (id UInt64, year UInt16) ENGINE = S3(s3_conn, filename='$s3_table', format=Parquet, partition_strategy='hive') PARTITION BY year"
query "INSERT INTO $rmt_table VALUES (3, 2020), (5, 2021)"
24
+
25
+
query "INSERT INTO $rmt_table VALUES (6, 2022), (7, 2022)"
26
+
27
+
query "ALTER TABLE $rmt_table EXPORT PARTITION ID '2020' TO TABLE $s3_table SETTINGS allow_experimental_export_merge_tree_part = 1"
28
+
29
+
query "ALTER TABLE $rmt_table EXPORT PARTITION ID '2021' TO TABLE $s3_table SETTINGS allow_experimental_export_merge_tree_part = 1"
30
+
31
+
# todo poll some kind of status
32
+
sleep 15
33
+
34
+
echo"Select from source table"
35
+
query "SELECT * FROM $rmt_table ORDER BY id"
36
+
37
+
echo"Select from destination table"
38
+
query "SELECT * FROM $s3_table ORDER BY id"
39
+
40
+
echo"Export partition 2022"
41
+
query "ALTER TABLE $rmt_table EXPORT PARTITION ID '2022' TO TABLE $s3_table SETTINGS allow_experimental_export_merge_tree_part = 1"
42
+
43
+
# todo poll some kind of status
44
+
sleep 5
45
+
46
+
echo"Select from destination table again"
47
+
query "SELECT * FROM $s3_table ORDER BY id"
48
+
49
+
query "CREATE TABLE $rmt_table_roundtrip ENGINE = ReplicatedMergeTree('/clickhouse/tables/{database}/$rmt_table_roundtrip', 'replica1') PARTITION BY year ORDER BY tuple() AS SELECT * FROM $s3_table"
50
+
51
+
echo"---- Data in roundtrip ReplicatedMergeTree table (should match s3_table)"
52
+
query "SELECT * FROM $rmt_table_roundtrip ORDER BY id"
53
+
54
+
query "DROP TABLE IF EXISTS $rmt_table, $s3_table, $rmt_table_roundtrip"
0 commit comments