@@ -100,12 +100,14 @@ def gen_target_iceberg_table(
100100) -> Table :
101101 additional_columns = ", t.order_id + 1000 as order_line_id" if composite_key else ""
102102
103- df = ctx .sql (f"""
103+ df = ctx .sql (
104+ f"""
104105 with t as (SELECT unnest(range({ start_row } ,{ end_row + 1 } )) as order_id)
105106 SELECT t.order_id { additional_columns }
106107 , date '2021-01-01' as order_date, 'A' as order_type
107108 from t
108- """ ).to_arrow_table ()
109+ """
110+ ).to_arrow_table ()
109111
110112 table = catalog .create_table (identifier , df .schema )
111113
@@ -166,23 +168,27 @@ def test_merge_scenario_skip_upd_row(catalog: Catalog) -> None:
166168
167169 ctx = SessionContext ()
168170
169- df = ctx .sql ("""
171+ df = ctx .sql (
172+ """
170173 select 1 as order_id, date '2021-01-01' as order_date, 'A' as order_type
171174 union all
172175 select 2 as order_id, date '2021-01-01' as order_date, 'A' as order_type
173- """ ).to_arrow_table ()
176+ """
177+ ).to_arrow_table ()
174178
175179 table = catalog .create_table (identifier , df .schema )
176180
177181 table .append (df )
178182
179- source_df = ctx .sql ("""
183+ source_df = ctx .sql (
184+ """
180185 select 1 as order_id, date '2021-01-01' as order_date, 'A' as order_type
181186 union all
182187 select 2 as order_id, date '2021-01-01' as order_date, 'B' as order_type
183188 union all
184189 select 3 as order_id, date '2021-01-01' as order_date, 'A' as order_type
185- """ ).to_arrow_table ()
190+ """
191+ ).to_arrow_table ()
186192
187193 res = table .upsert (df = source_df , join_cols = ["order_id" ])
188194
@@ -202,23 +208,27 @@ def test_merge_scenario_date_as_key(catalog: Catalog) -> None:
202208 identifier = "default.test_merge_scenario_date_as_key"
203209 _drop_table (catalog , identifier )
204210
205- df = ctx .sql ("""
211+ df = ctx .sql (
212+ """
206213 select date '2021-01-01' as order_date, 'A' as order_type
207214 union all
208215 select date '2021-01-02' as order_date, 'A' as order_type
209- """ ).to_arrow_table ()
216+ """
217+ ).to_arrow_table ()
210218
211219 table = catalog .create_table (identifier , df .schema )
212220
213221 table .append (df )
214222
215- source_df = ctx .sql ("""
223+ source_df = ctx .sql (
224+ """
216225 select date '2021-01-01' as order_date, 'A' as order_type
217226 union all
218227 select date '2021-01-02' as order_date, 'B' as order_type
219228 union all
220229 select date '2021-01-03' as order_date, 'A' as order_type
221- """ ).to_arrow_table ()
230+ """
231+ ).to_arrow_table ()
222232
223233 res = table .upsert (df = source_df , join_cols = ["order_date" ])
224234
@@ -238,23 +248,27 @@ def test_merge_scenario_string_as_key(catalog: Catalog) -> None:
238248
239249 ctx = SessionContext ()
240250
241- df = ctx .sql ("""
251+ df = ctx .sql (
252+ """
242253 select 'abc' as order_id, 'A' as order_type
243254 union all
244255 select 'def' as order_id, 'A' as order_type
245- """ ).to_arrow_table ()
256+ """
257+ ).to_arrow_table ()
246258
247259 table = catalog .create_table (identifier , df .schema )
248260
249261 table .append (df )
250262
251- source_df = ctx .sql ("""
263+ source_df = ctx .sql (
264+ """
252265 select 'abc' as order_id, 'A' as order_type
253266 union all
254267 select 'def' as order_id, 'B' as order_type
255268 union all
256269 select 'ghi' as order_id, 'A' as order_type
257- """ ).to_arrow_table ()
270+ """
271+ ).to_arrow_table ()
258272
259273 res = table .upsert (df = source_df , join_cols = ["order_id" ])
260274
@@ -1563,5 +1577,3 @@ def test_coarse_match_filter_composite_key_mixed_types() -> None:
15631577 # numeric_id is sparse (density < 10%), so should use In()
15641578 # string_id is non-numeric, so should use In()
15651579 assert isinstance (result , And )
1566-
1567-
0 commit comments