|
8 | 8 | import random |
9 | 9 | import threading |
10 | 10 | import time |
11 | | -import uuid |
12 | 11 |
|
13 | 12 | import pytest |
14 | 13 | from azure.storage.blob import BlobServiceClient |
@@ -77,131 +76,21 @@ def test_select_all(cluster): |
77 | 76 | ) |
78 | 77 | print(get_azure_file_content("test_cluster_select_all.csv", port)) |
79 | 78 |
|
80 | | - query_id_pure = str(uuid.uuid4()) |
81 | 79 | pure_azure = azure_query( |
82 | 80 | node, |
83 | 81 | f"SELECT * from azureBlobStorage('{storage_account_url}', 'cont', 'test_cluster_select_all.csv', 'devstoreaccount1'," |
84 | 82 | f"'Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==', 'CSV','auto')", |
85 | | - query_id=query_id_pure, |
86 | 83 | ) |
87 | 84 | print(pure_azure) |
88 | | - query_id_distributed = str(uuid.uuid4()) |
89 | 85 | distributed_azure = azure_query( |
90 | 86 | node, |
91 | 87 | f"SELECT * from azureBlobStorageCluster('simple_cluster', '{storage_account_url}', 'cont', 'test_cluster_select_all.csv', 'devstoreaccount1'," |
92 | 88 | f"'Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==', 'CSV'," |
93 | | - f"'auto')", |
94 | | - query_id=query_id_distributed, |
| 89 | + f"'auto')" |
| 90 | + "", |
95 | 91 | ) |
96 | 92 | print(distributed_azure) |
97 | | - query_id_distributed_alt_syntax = str(uuid.uuid4()) |
98 | | - distributed_azure_alt_syntax = azure_query( |
99 | | - node, |
100 | | - f"SELECT * from azureBlobStorage('{storage_account_url}', 'cont', 'test_cluster_select_all.csv', 'devstoreaccount1'," |
101 | | - f"'Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==', 'CSV'," |
102 | | - f"'auto') " |
103 | | - f"SETTINGS object_storage_cluster='simple_cluster'", |
104 | | - query_id=query_id_distributed_alt_syntax, |
105 | | - ) |
106 | | - print(distributed_azure_alt_syntax) |
107 | | - azure_query( |
108 | | - node, |
109 | | - f""" |
110 | | - DROP TABLE IF EXISTS azure_engine_table_single_node; |
111 | | - CREATE TABLE azure_engine_table_single_node |
112 | | - (key UInt64, data String) |
113 | | - ENGINE=AzureBlobStorage( |
114 | | - '{storage_account_url}', |
115 | | - 'cont', |
116 | | - 'test_cluster_select_all.csv', |
117 | | - 'devstoreaccount1', |
118 | | - 'Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==', |
119 | | - 'CSV', |
120 | | - 'auto' |
121 | | - ) |
122 | | - """, |
123 | | - ) |
124 | | - query_id_engine_single_node = str(uuid.uuid4()) |
125 | | - azure_engine_single_node = azure_query( |
126 | | - node, |
127 | | - "SELECT * FROM azure_engine_table_single_node", |
128 | | - query_id=query_id_engine_single_node, |
129 | | - ) |
130 | | - azure_query( |
131 | | - node, |
132 | | - f""" |
133 | | - DROP TABLE IF EXISTS azure_engine_table_distributed; |
134 | | - CREATE TABLE azure_engine_table_distributed |
135 | | - (key UInt64, data String) |
136 | | - ENGINE=AzureBlobStorage( |
137 | | - '{storage_account_url}', |
138 | | - 'cont', |
139 | | - 'test_cluster_select_all.csv', |
140 | | - 'devstoreaccount1', |
141 | | - 'Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==', |
142 | | - 'CSV', |
143 | | - 'auto' |
144 | | - ) |
145 | | - SETTINGS object_storage_cluster='simple_cluster' |
146 | | - """, |
147 | | - ) |
148 | | - query_id_engine_distributed = str(uuid.uuid4()) |
149 | | - azure_engine_distributed = azure_query( |
150 | | - node, |
151 | | - "SELECT * FROM azure_engine_table_distributed", |
152 | | - query_id=query_id_engine_distributed, |
153 | | - ) |
154 | 93 | assert TSV(pure_azure) == TSV(distributed_azure) |
155 | | - assert TSV(pure_azure) == TSV(distributed_azure_alt_syntax) |
156 | | - assert TSV(pure_azure) == TSV(azure_engine_single_node) |
157 | | - assert TSV(pure_azure) == TSV(azure_engine_distributed) |
158 | | - for _, node_ in cluster.instances.items(): |
159 | | - node_.query("SYSTEM FLUSH LOGS") |
160 | | - nodes_pure = node.query( |
161 | | - f""" |
162 | | - SELECT uniq(hostname) |
163 | | - FROM clusterAllReplicas('simple_cluster', system.query_log) |
164 | | - WHERE type='QueryFinish' |
165 | | - AND initial_query_id='{query_id_pure}' |
166 | | - """, |
167 | | - ) |
168 | | - assert int(nodes_pure) == 1 |
169 | | - nodes_distributed = node.query( |
170 | | - f""" |
171 | | - SELECT uniq(hostname) |
172 | | - FROM clusterAllReplicas('simple_cluster', system.query_log) |
173 | | - WHERE type='QueryFinish' |
174 | | - AND initial_query_id='{query_id_distributed}' |
175 | | - """, |
176 | | - ) |
177 | | - assert int(nodes_distributed) == 3 |
178 | | - nodes_distributed_alt_syntax = node.query( |
179 | | - f""" |
180 | | - SELECT uniq(hostname) |
181 | | - FROM clusterAllReplicas('simple_cluster', system.query_log) |
182 | | - WHERE type='QueryFinish' |
183 | | - AND initial_query_id='{query_id_distributed_alt_syntax}' |
184 | | - """, |
185 | | - ) |
186 | | - assert int(nodes_distributed_alt_syntax) == 3 |
187 | | - nodes_engine_single_node = node.query( |
188 | | - f""" |
189 | | - SELECT uniq(hostname) |
190 | | - FROM clusterAllReplicas('simple_cluster', system.query_log) |
191 | | - WHERE type='QueryFinish' |
192 | | - AND initial_query_id='{query_id_engine_single_node}' |
193 | | - """, |
194 | | - ) |
195 | | - assert int(nodes_engine_single_node) == 1 |
196 | | - nodes_engine_distributed = node.query( |
197 | | - f""" |
198 | | - SELECT uniq(hostname) |
199 | | - FROM clusterAllReplicas('simple_cluster', system.query_log) |
200 | | - WHERE type='QueryFinish' |
201 | | - AND initial_query_id='{query_id_engine_distributed}' |
202 | | - """, |
203 | | - ) |
204 | | - assert int(nodes_engine_distributed) == 3 |
205 | 94 |
|
206 | 95 |
|
207 | 96 | def test_count(cluster): |
@@ -231,16 +120,7 @@ def test_count(cluster): |
231 | 120 | f"'auto', 'key UInt64')", |
232 | 121 | ) |
233 | 122 | print(distributed_azure) |
234 | | - distributed_azure_alt_syntax = azure_query( |
235 | | - node, |
236 | | - f"SELECT count(*) from azureBlobStorage('{storage_account_url}', 'cont', 'test_cluster_count.csv', " |
237 | | - f"'devstoreaccount1','Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==', 'CSV'," |
238 | | - f"'auto', 'key UInt64')" |
239 | | - f"SETTINGS object_storage_cluster='simple_cluster'", |
240 | | - ) |
241 | | - print(distributed_azure_alt_syntax) |
242 | 123 | assert TSV(pure_azure) == TSV(distributed_azure) |
243 | | - assert TSV(pure_azure) == TSV(distributed_azure_alt_syntax) |
244 | 124 |
|
245 | 125 |
|
246 | 126 | def test_union_all(cluster): |
|
0 commit comments