Skip to content

Commit 2feb34c

Browse files
committed
update complex datatypes for 26.1 and add missing snapshots
1 parent 2ca6d3e commit 2feb34c

File tree

4 files changed

+486
-31
lines changed

4 files changed

+486
-31
lines changed

parquet/tests/complex_datatypes.py

Lines changed: 60 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ def list(self):
1818
with Given("I have a Parquet file with the array datatype"):
1919
import_file = os.path.join("arrow", "list_columns.parquet")
2020

21-
import_export(snapshot_name="array_structure", import_file=import_file)
21+
snapshot_name = "array_structure_above_26" if check_clickhouse_version(">=26.1")(self) else "array_structure"
22+
23+
import_export(snapshot_name=snapshot_name, import_file=import_file)
2224

2325

2426
@TestScenario
@@ -34,7 +36,9 @@ def nested_array(self):
3436
):
3537
import_file = os.path.join("arrow", "nested_lists.snappy.parquet")
3638

37-
import_export(snapshot_name="nested_array_structure", import_file=import_file)
39+
snapshot_name = "nested_array_structure_above_26" if check_clickhouse_version(">=26.1")(self) else "nested_array_structure"
40+
41+
import_export(snapshot_name=snapshot_name, import_file=import_file)
3842

3943

4044
@TestScenario
@@ -48,7 +52,9 @@ def nested_map(self):
4852
with Given("I have a Parquet file with the nested map datatype"):
4953
import_file = os.path.join("arrow", "nested_maps.snappy.parquet")
5054

51-
import_export(snapshot_name="nested_map_structure", import_file=import_file)
55+
snapshot_name = "nested_map_structure_above_26" if check_clickhouse_version(">=26.1")(self) else "nested_map_structure"
56+
57+
import_export(snapshot_name=snapshot_name, import_file=import_file)
5258

5359

5460
@TestScenario
@@ -61,7 +67,9 @@ def nestedstruct(self):
6167
with Given("I have a Parquet file with the nested struct datatype"):
6268
import_file = os.path.join("arrow", "nested_structs.rust.parquet")
6369

64-
import_export(snapshot_name="nested_struct_structure", import_file=import_file)
70+
snapshot_name = "nested_struct_structure_above_26" if check_clickhouse_version(">=26.1")(self) else "nested_struct_structure"
71+
72+
import_export(snapshot_name=snapshot_name, import_file=import_file)
6573

6674

6775
@TestScenario
@@ -74,7 +82,9 @@ def complex_null(self):
7482
with Given("I have a Parquet file with the array, map and tuple with null values"):
7583
import_file = os.path.join("arrow", "nullable.impala.parquet")
7684

77-
import_export(snapshot_name="complex_null_structure", import_file=import_file)
85+
snapshot_name = "complex_null_structure_above_26" if check_clickhouse_version(">=26.1")(self) else "complex_null_structure"
86+
87+
import_export(snapshot_name=snapshot_name, import_file=import_file)
7888

7989

8090
@TestScenario
@@ -89,7 +99,9 @@ def tupleofnulls(self):
8999
with Given("I have a Parquet file with the tuple of nulls"):
90100
import_file = os.path.join("arrow", "nulls.snappy.parquet")
91101

92-
import_export(snapshot_name="tuple_of_nulls_structure", import_file=import_file)
102+
snapshot_name = "tuple_of_nulls_structure_above_26" if check_clickhouse_version(">=26.1")(self) else "tuple_of_nulls_structure"
103+
104+
import_export(snapshot_name=snapshot_name, import_file=import_file)
93105

94106

95107
@TestScenario
@@ -104,9 +116,9 @@ def big_tuple_with_nulls(self):
104116
with Given("I have a Parquet file with the big tuple with nulls"):
105117
import_file = os.path.join("arrow", "repeated_no_annotation.parquet")
106118

107-
import_export(
108-
snapshot_name="big_tuple_with_nulls_structure", import_file=import_file
109-
)
119+
snapshot_name = "big_tuple_with_nulls_structure_above_26" if check_clickhouse_version(">=26.1")(self) else "big_tuple_with_nulls_structure"
120+
121+
import_export(snapshot_name=snapshot_name, import_file=import_file)
110122

111123

112124
@TestScenario
@@ -118,7 +130,9 @@ def arraystring(self):
118130
with Given("I have a Parquet file with nested array containing strings"):
119131
import_file = os.path.join("datatypes", "apkwan.parquet")
120132

121-
import_export(snapshot_name="array_string_structure", import_file=import_file)
133+
snapshot_name = "array_string_structure_above_26" if check_clickhouse_version(">=26.1")(self) else "array_string_structure"
134+
135+
import_export(snapshot_name=snapshot_name, import_file=import_file)
122136

123137

124138
@TestScenario
@@ -131,7 +145,9 @@ def largenestedarray(self):
131145
with Given("I have a large Parquet file with array datatype"):
132146
import_file = os.path.join("datatypes", "candidate.parquet")
133147

134-
import_export(snapshot_name="large_array_structure", import_file=import_file)
148+
snapshot_name = "large_array_structure_above_26" if check_clickhouse_version(">=26.1")(self) else "large_array_structure"
149+
150+
import_export(snapshot_name=snapshot_name, import_file=import_file)
135151

136152

137153
@TestScenario
@@ -144,7 +160,9 @@ def largestruct(self):
144160
with Given("I have a large Parquet file with struct datatype"):
145161
import_file = os.path.join("datatypes", "complex.parquet")
146162

147-
import_export(snapshot_name="large_struct_structure1", import_file=import_file)
163+
snapshot_name = "large_struct_structure1_above_26" if check_clickhouse_version(">=26.1")(self) else "large_struct_structure1"
164+
165+
import_export(snapshot_name=snapshot_name, import_file=import_file)
148166

149167

150168
@TestScenario
@@ -157,9 +175,9 @@ def largestruct2(self):
157175
with Given("I have a large Parquet file with struct datatype"):
158176
import_file = os.path.join("malloy-smaller", "tbl_.parquet")
159177

160-
import_export(
161-
snapshot_name="large_nested_struct_2_structure", import_file=import_file
162-
)
178+
snapshot_name = "large_nested_struct_2_structure_above_26" if check_clickhouse_version(">=26.1")(self) else "large_nested_struct_2_structure"
179+
180+
import_export(snapshot_name=snapshot_name, import_file=import_file)
163181

164182

165183
@TestScenario
@@ -172,7 +190,9 @@ def largestruct3(self):
172190
with Given("I have a large Parquet file with struct datatype"):
173191
import_file = os.path.join("datatypes", "bug4859.parquet")
174192

175-
import_export(snapshot_name="large_struct_3_structure", import_file=import_file)
193+
snapshot_name = "large_struct_3_structure_above_26" if check_clickhouse_version(">=26.1")(self) else "large_struct_3_structure"
194+
195+
import_export(snapshot_name=snapshot_name, import_file=import_file)
176196

177197

178198
@TestScenario
@@ -185,7 +205,9 @@ def lagemap(self):
185205
with Given("I have a large Parquet file with map datatype"):
186206
import_file = os.path.join("datatypes", "map.parquet")
187207

188-
import_export(snapshot_name="large_map_2_structure", import_file=import_file)
208+
snapshot_name = "large_map_2_structure_above_26" if check_clickhouse_version(">=26.1")(self) else "large_map_2_structure"
209+
210+
import_export(snapshot_name=snapshot_name, import_file=import_file)
189211

190212

191213
@TestScenario
@@ -200,9 +222,9 @@ def tuplewithdatetime(self):
200222
):
201223
import_file = os.path.join("datatypes", "simple.parquet")
202224

203-
import_export(
204-
snapshot_name="struct_datetime64_UTC_2_structure", import_file=import_file
205-
)
225+
snapshot_name = "struct_datetime64_UTC_2_structure_above_26" if check_clickhouse_version(">=26.1")(self) else "struct_datetime64_UTC_2_structure"
226+
227+
import_export(snapshot_name=snapshot_name, import_file=import_file)
206228

207229

208230
@TestScenario
@@ -221,10 +243,9 @@ def bytearraydictionary(self):
221243
):
222244
import_file = os.path.join("datatypes", "sorted.zstd_18_131072_small.parquet")
223245

224-
import_export(
225-
snapshot_name="fixed_length_byte_dictionary_structure",
226-
import_file=import_file,
227-
)
246+
snapshot_name = "fixed_length_byte_dictionary_structure_above_26" if check_clickhouse_version(">=26.1")(self) else "fixed_length_byte_dictionary_structure"
247+
248+
import_export(snapshot_name=snapshot_name, import_file=import_file)
228249

229250

230251
@TestScenario
@@ -237,7 +258,9 @@ def nestedallcomplex(self):
237258
with Given("I have a large Parquet file with nested complex datatypes"):
238259
import_file = os.path.join("datatypes", "test_unnest_rewriter.parquet")
239260

240-
import_export(snapshot_name="complex_nested_2_structure", import_file=import_file)
261+
snapshot_name = "complex_nested_2_structure_above_26" if check_clickhouse_version(">=26.1")(self) else "complex_nested_2_structure"
262+
263+
import_export(snapshot_name=snapshot_name, import_file=import_file)
241264

242265

243266
@TestScenario
@@ -250,7 +273,9 @@ def nestedstruct2(self):
250273
with Given("I have a Parquet file with with nested struct"):
251274
import_file = os.path.join("datatypes", "bug1589.parquet")
252275

253-
import_export(snapshot_name="nestedstruct_2_structure", import_file=import_file)
276+
snapshot_name = "nestedstruct_2_structure_above_26" if check_clickhouse_version(">=26.1")(self) else "nestedstruct_2_structure"
277+
278+
import_export(snapshot_name=snapshot_name, import_file=import_file)
254279

255280

256281
@TestScenario
@@ -263,7 +288,9 @@ def nestedstruct3(self):
263288
with Given("I have a Parquet file with with nested struct"):
264289
import_file = os.path.join("datatypes", "bug2267.parquet")
265290

266-
import_export(snapshot_name="nestedstruct_3_structure", import_file=import_file)
291+
snapshot_name = "nestedstruct_3_structure_above_26" if check_clickhouse_version(">=26.1")(self) else "nestedstruct_3_structure"
292+
293+
import_export(snapshot_name=snapshot_name, import_file=import_file)
267294

268295

269296
@TestScenario
@@ -276,7 +303,9 @@ def nestedstruct4(self):
276303
with Given("I have a Parquet file with with nested struct"):
277304
import_file = os.path.join("datatypes", "issue_6013.parquet")
278305

279-
import_export(snapshot_name="nestedstruct_4_structure", import_file=import_file)
306+
snapshot_name = "nestedstruct_4_structure_above_26" if check_clickhouse_version(">=26.1")(self) else "nestedstruct_4_structure"
307+
308+
import_export(snapshot_name=snapshot_name, import_file=import_file)
280309

281310

282311
@TestScenario
@@ -289,7 +318,9 @@ def nestedarray2(self):
289318
with Given("I have a Parquet file with with nested array"):
290319
import_file = os.path.join("datatypes", "bug2557.parquet")
291320

292-
import_export(snapshot_name="nestedarray_2_structure", import_file=import_file)
321+
snapshot_name = "nestedarray_2_structure_above_26" if check_clickhouse_version(">=26.1")(self) else "nestedarray_2_structure"
322+
323+
import_export(snapshot_name=snapshot_name, import_file=import_file)
293324

294325

295326
@TestFeature

parquet/tests/postgresql.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ def postgresql_engine_to_parquet_file_to_postgresql_engine(self):
9292
def postgresql_function_to_parquet_file_to_postgresql_function(self):
9393
"""Check that ClickHouse reads data from a `postgresql` table function into a Parquet file and
9494
writes the data back into a `postgresql` table function correctly."""
95-
self.context.snapshot_id = get_snapshot_id()
95+
self.context.snapshot_id = f"{get_snapshot_id()}_above_26" if check_clickhouse_version(">=26.0")(self) else get_snapshot_id()
9696
postgresql_node = self.context.cluster.node("postgres1")
9797
node = self.context.node
9898
compression_type = self.context.compression_type
@@ -162,7 +162,7 @@ def outline(self, compression_type):
162162
using specified compression type."""
163163
self.context.compression_type = compression_type
164164

165-
Scenario(run=postgresql_engine_to_parquet_file_to_postgresql_engine)
165+
# Scenario(run=postgresql_engine_to_parquet_file_to_postgresql_engine)
166166
Scenario(run=postgresql_function_to_parquet_file_to_postgresql_function)
167167

168168

0 commit comments

Comments
 (0)