deltacat 1.1.3__py3-none-any.whl → 1.1.5__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -107,6 +107,7 @@ REBASE_THEN_INCREMENTAL_TEST_CASES = {
107
107
  names=["pk_col_1", "sk_col_1", "sk_col_2", "col_1"],
108
108
  ),
109
109
  expected_terminal_exception=None,
110
+ expected_terminal_exception_message=None,
110
111
  do_create_placement_group=False,
111
112
  records_per_compacted_file=DEFAULT_MAX_RECORDS_PER_FILE,
112
113
  hash_bucket_count=DEFAULT_HASH_BUCKET_COUNT,
@@ -186,6 +187,7 @@ REBASE_THEN_INCREMENTAL_TEST_CASES = {
186
187
  names=["pk_col_1", "pk_col_2", "sk_col_1", "col_1"],
187
188
  ),
188
189
  expected_terminal_exception=None,
190
+ expected_terminal_exception_message=None,
189
191
  do_create_placement_group=False,
190
192
  records_per_compacted_file=DEFAULT_MAX_RECORDS_PER_FILE,
191
193
  hash_bucket_count=DEFAULT_HASH_BUCKET_COUNT,
@@ -234,6 +236,7 @@ REBASE_THEN_INCREMENTAL_TEST_CASES = {
234
236
  names=["pk_col_1", "col_1"],
235
237
  ),
236
238
  expected_terminal_exception=None,
239
+ expected_terminal_exception_message=None,
237
240
  do_create_placement_group=False,
238
241
  records_per_compacted_file=DEFAULT_MAX_RECORDS_PER_FILE,
239
242
  hash_bucket_count=DEFAULT_HASH_BUCKET_COUNT,
@@ -282,6 +285,7 @@ REBASE_THEN_INCREMENTAL_TEST_CASES = {
282
285
  names=["pk_col_1", "col_1"],
283
286
  ),
284
287
  expected_terminal_exception=None,
288
+ expected_terminal_exception_message=None,
285
289
  do_create_placement_group=False,
286
290
  records_per_compacted_file=DEFAULT_MAX_RECORDS_PER_FILE,
287
291
  hash_bucket_count=DEFAULT_HASH_BUCKET_COUNT,
@@ -336,6 +340,7 @@ REBASE_THEN_INCREMENTAL_TEST_CASES = {
336
340
  names=["pk_col_1", "sk_col_1", "col_1"],
337
341
  ),
338
342
  expected_terminal_exception=None,
343
+ expected_terminal_exception_message=None,
339
344
  do_create_placement_group=False,
340
345
  records_per_compacted_file=DEFAULT_MAX_RECORDS_PER_FILE,
341
346
  hash_bucket_count=DEFAULT_HASH_BUCKET_COUNT,
@@ -395,6 +400,7 @@ REBASE_THEN_INCREMENTAL_TEST_CASES = {
395
400
  names=["pk_col_1", "sk_col_1", "sk_col_2", "col_1"],
396
401
  ),
397
402
  expected_terminal_exception=None,
403
+ expected_terminal_exception_message=None,
398
404
  do_create_placement_group=False,
399
405
  records_per_compacted_file=10,
400
406
  hash_bucket_count=DEFAULT_HASH_BUCKET_COUNT + 10,
@@ -445,6 +451,7 @@ REBASE_THEN_INCREMENTAL_TEST_CASES = {
445
451
  names=["sk_col_1", "col_1"],
446
452
  ),
447
453
  expected_terminal_exception=None,
454
+ expected_terminal_exception_message=None,
448
455
  do_create_placement_group=False,
449
456
  records_per_compacted_file=10,
450
457
  hash_bucket_count=DEFAULT_HASH_BUCKET_COUNT,
@@ -500,6 +507,7 @@ REBASE_THEN_INCREMENTAL_TEST_CASES = {
500
507
  names=["pk_col_1", "col_1"],
501
508
  ),
502
509
  expected_terminal_exception=None,
510
+ expected_terminal_exception_message=None,
503
511
  do_create_placement_group=False,
504
512
  records_per_compacted_file=DEFAULT_MAX_RECORDS_PER_FILE,
505
513
  hash_bucket_count=DEFAULT_HASH_BUCKET_COUNT,
@@ -559,6 +567,7 @@ REBASE_THEN_INCREMENTAL_TEST_CASES = {
559
567
  names=["pk_col_1", "sk_col_1", "sk_col_2", "col_1"],
560
568
  ),
561
569
  expected_terminal_exception=None,
570
+ expected_terminal_exception_message=None,
562
571
  do_create_placement_group=False,
563
572
  records_per_compacted_file=DEFAULT_MAX_RECORDS_PER_FILE,
564
573
  hash_bucket_count=1,
@@ -613,6 +622,7 @@ REBASE_THEN_INCREMENTAL_TEST_CASES = {
613
622
  names=["pk_col_1", "sk_col_1", "col_1"],
614
623
  ),
615
624
  expected_terminal_exception=None,
625
+ expected_terminal_exception_message=None,
616
626
  do_create_placement_group=False,
617
627
  records_per_compacted_file=DEFAULT_MAX_RECORDS_PER_FILE,
618
628
  hash_bucket_count=DEFAULT_HASH_BUCKET_COUNT,
@@ -658,6 +668,7 @@ REBASE_THEN_INCREMENTAL_TEST_CASES = {
658
668
  names=["pk_col_1", "sk_col_1", "sk_col_2", "col_1"],
659
669
  ),
660
670
  expected_terminal_exception=None,
671
+ expected_terminal_exception_message=None,
661
672
  do_create_placement_group=False,
662
673
  records_per_compacted_file=DEFAULT_MAX_RECORDS_PER_FILE,
663
674
  hash_bucket_count=3,
@@ -717,6 +728,7 @@ REBASE_THEN_INCREMENTAL_TEST_CASES = {
717
728
  names=["pk_col_1", "sk_col_1", "sk_col_2", "col_1"],
718
729
  ),
719
730
  expected_terminal_exception=None,
731
+ expected_terminal_exception_message=None,
720
732
  do_create_placement_group=False,
721
733
  records_per_compacted_file=DEFAULT_MAX_RECORDS_PER_FILE,
722
734
  hash_bucket_count=1,
@@ -762,6 +774,7 @@ REBASE_THEN_INCREMENTAL_TEST_CASES = {
762
774
  names=["pk_col_1", "sk_col_1", "sk_col_2", "col_1"],
763
775
  ),
764
776
  expected_terminal_exception=None,
777
+ expected_terminal_exception_message=None,
765
778
  do_create_placement_group=False,
766
779
  records_per_compacted_file=DEFAULT_MAX_RECORDS_PER_FILE,
767
780
  hash_bucket_count=1,
@@ -861,6 +874,7 @@ REBASE_THEN_INCREMENTAL_DELETE_DELTA_TYPE_TEST_CASES = {
861
874
  names=["pk_col_1", "col_1"],
862
875
  ),
863
876
  expected_terminal_exception=None,
877
+ expected_terminal_exception_message=None,
864
878
  do_create_placement_group=False,
865
879
  records_per_compacted_file=DEFAULT_MAX_RECORDS_PER_FILE,
866
880
  hash_bucket_count=DEFAULT_HASH_BUCKET_COUNT,
@@ -911,6 +925,7 @@ REBASE_THEN_INCREMENTAL_DELETE_DELTA_TYPE_TEST_CASES = {
911
925
  names=["pk_col_1", "pk_col_2", "col_1"],
912
926
  ),
913
927
  expected_terminal_exception=None,
928
+ expected_terminal_exception_message=None,
914
929
  do_create_placement_group=False,
915
930
  records_per_compacted_file=DEFAULT_MAX_RECORDS_PER_FILE,
916
931
  hash_bucket_count=DEFAULT_HASH_BUCKET_COUNT,
@@ -967,6 +982,7 @@ REBASE_THEN_INCREMENTAL_DELETE_DELTA_TYPE_TEST_CASES = {
967
982
  ),
968
983
  ),
969
984
  expected_terminal_exception=None,
985
+ expected_terminal_exception_message=None,
970
986
  do_create_placement_group=False,
971
987
  records_per_compacted_file=DEFAULT_MAX_RECORDS_PER_FILE,
972
988
  hash_bucket_count=DEFAULT_HASH_BUCKET_COUNT,
@@ -1019,6 +1035,7 @@ REBASE_THEN_INCREMENTAL_DELETE_DELTA_TYPE_TEST_CASES = {
1019
1035
  ),
1020
1036
  ),
1021
1037
  expected_terminal_exception=None,
1038
+ expected_terminal_exception_message=None,
1022
1039
  do_create_placement_group=True,
1023
1040
  records_per_compacted_file=DEFAULT_MAX_RECORDS_PER_FILE,
1024
1041
  hash_bucket_count=DEFAULT_HASH_BUCKET_COUNT,
@@ -1099,6 +1116,7 @@ REBASE_THEN_INCREMENTAL_DELETE_DELTA_TYPE_TEST_CASES = {
1099
1116
  names=["pk_col_1", "col_1"],
1100
1117
  ),
1101
1118
  expected_terminal_exception=None,
1119
+ expected_terminal_exception_message=None,
1102
1120
  do_create_placement_group=True,
1103
1121
  records_per_compacted_file=DEFAULT_MAX_RECORDS_PER_FILE,
1104
1122
  hash_bucket_count=DEFAULT_HASH_BUCKET_COUNT,
@@ -1168,6 +1186,7 @@ REBASE_THEN_INCREMENTAL_DELETE_DELTA_TYPE_TEST_CASES = {
1168
1186
  names=["pk_col_1", "col_1"],
1169
1187
  ),
1170
1188
  expected_terminal_exception=None,
1189
+ expected_terminal_exception_message=None,
1171
1190
  do_create_placement_group=True,
1172
1191
  records_per_compacted_file=DEFAULT_MAX_RECORDS_PER_FILE,
1173
1192
  hash_bucket_count=DEFAULT_HASH_BUCKET_COUNT,
@@ -1231,6 +1250,7 @@ REBASE_THEN_INCREMENTAL_DELETE_DELTA_TYPE_TEST_CASES = {
1231
1250
  ),
1232
1251
  ),
1233
1252
  expected_terminal_exception=None,
1253
+ expected_terminal_exception_message=None,
1234
1254
  do_create_placement_group=True,
1235
1255
  records_per_compacted_file=DEFAULT_MAX_RECORDS_PER_FILE,
1236
1256
  hash_bucket_count=DEFAULT_HASH_BUCKET_COUNT,
@@ -1321,6 +1341,7 @@ REBASE_THEN_INCREMENTAL_DELETE_DELTA_TYPE_TEST_CASES = {
1321
1341
  names=["pk_col_1", "col_1"],
1322
1342
  ),
1323
1343
  expected_terminal_exception=None,
1344
+ expected_terminal_exception_message=None,
1324
1345
  do_create_placement_group=True,
1325
1346
  records_per_compacted_file=DEFAULT_MAX_RECORDS_PER_FILE,
1326
1347
  hash_bucket_count=DEFAULT_HASH_BUCKET_COUNT,
@@ -1384,6 +1405,7 @@ REBASE_THEN_INCREMENTAL_DELETE_DELTA_TYPE_TEST_CASES = {
1384
1405
  ),
1385
1406
  ),
1386
1407
  expected_terminal_exception=None,
1408
+ expected_terminal_exception_message=None,
1387
1409
  do_create_placement_group=True,
1388
1410
  records_per_compacted_file=DEFAULT_MAX_RECORDS_PER_FILE,
1389
1411
  hash_bucket_count=DEFAULT_HASH_BUCKET_COUNT,
@@ -1453,6 +1475,7 @@ REBASE_THEN_INCREMENTAL_DELETE_DELTA_TYPE_TEST_CASES = {
1453
1475
  names=["pk_col_1", "col_1"],
1454
1476
  ),
1455
1477
  expected_terminal_exception=None,
1478
+ expected_terminal_exception_message=None,
1456
1479
  do_create_placement_group=True,
1457
1480
  records_per_compacted_file=DEFAULT_MAX_RECORDS_PER_FILE,
1458
1481
  hash_bucket_count=DEFAULT_HASH_BUCKET_COUNT,
@@ -1516,6 +1539,7 @@ REBASE_THEN_INCREMENTAL_DELETE_DELTA_TYPE_TEST_CASES = {
1516
1539
  ),
1517
1540
  ),
1518
1541
  expected_terminal_exception=AssertionError,
1542
+ expected_terminal_exception_message="Delete type deltas are required to have delete parameters defined",
1519
1543
  do_create_placement_group=True,
1520
1544
  records_per_compacted_file=DEFAULT_MAX_RECORDS_PER_FILE,
1521
1545
  hash_bucket_count=DEFAULT_HASH_BUCKET_COUNT,
@@ -1580,6 +1604,7 @@ REBASE_THEN_INCREMENTAL_DELETE_DELTA_TYPE_TEST_CASES = {
1580
1604
  names=["pk_col_1", "col_1"],
1581
1605
  ),
1582
1606
  expected_terminal_exception=None,
1607
+ expected_terminal_exception_message=None,
1583
1608
  do_create_placement_group=True,
1584
1609
  records_per_compacted_file=DEFAULT_MAX_RECORDS_PER_FILE,
1585
1610
  hash_bucket_count=DEFAULT_HASH_BUCKET_COUNT,
@@ -1638,6 +1663,7 @@ REBASE_THEN_INCREMENTAL_DELETE_DELTA_TYPE_TEST_CASES = {
1638
1663
  names=["pk_col_1", "col_1"],
1639
1664
  ),
1640
1665
  expected_terminal_exception=None,
1666
+ expected_terminal_exception_message=None,
1641
1667
  do_create_placement_group=True,
1642
1668
  records_per_compacted_file=DEFAULT_MAX_RECORDS_PER_FILE,
1643
1669
  hash_bucket_count=DEFAULT_HASH_BUCKET_COUNT,
@@ -1706,6 +1732,7 @@ REBASE_THEN_INCREMENTAL_DELETE_DELTA_TYPE_TEST_CASES = {
1706
1732
  names=["pk_col_1", "col_1"],
1707
1733
  ),
1708
1734
  expected_terminal_exception=None,
1735
+ expected_terminal_exception_message=None,
1709
1736
  do_create_placement_group=True,
1710
1737
  records_per_compacted_file=DEFAULT_MAX_RECORDS_PER_FILE,
1711
1738
  hash_bucket_count=DEFAULT_HASH_BUCKET_COUNT,
@@ -1795,6 +1822,7 @@ REBASE_THEN_INCREMENTAL_DELETE_DELTA_TYPE_TEST_CASES = {
1795
1822
  names=["pk_col_1", "sk_col_1", "sk_col_2", "col_1"],
1796
1823
  ),
1797
1824
  expected_terminal_exception=None,
1825
+ expected_terminal_exception_message=None,
1798
1826
  do_create_placement_group=False,
1799
1827
  records_per_compacted_file=DEFAULT_MAX_RECORDS_PER_FILE,
1800
1828
  hash_bucket_count=1,
@@ -1865,6 +1893,7 @@ REBASE_THEN_INCREMENTAL_DELETE_DELTA_TYPE_TEST_CASES = {
1865
1893
  names=["sk_col_1", "col_1"],
1866
1894
  ),
1867
1895
  expected_terminal_exception=None,
1896
+ expected_terminal_exception_message=None,
1868
1897
  do_create_placement_group=False,
1869
1898
  records_per_compacted_file=10,
1870
1899
  hash_bucket_count=DEFAULT_HASH_BUCKET_COUNT,
@@ -1913,6 +1942,7 @@ REBASE_THEN_INCREMENTAL_DELETE_DELTA_TYPE_TEST_CASES = {
1913
1942
  names=["pk_col_1", "col_1"],
1914
1943
  ),
1915
1944
  expected_terminal_exception=None,
1945
+ expected_terminal_exception_message=None,
1916
1946
  do_create_placement_group=False,
1917
1947
  records_per_compacted_file=DEFAULT_MAX_RECORDS_PER_FILE,
1918
1948
  hash_bucket_count=DEFAULT_HASH_BUCKET_COUNT,
@@ -54,6 +54,7 @@ class BaseCompactorTestCase:
54
54
  input_deltas_delta_type: DeltaType - enumerated argument required for delta creation during compact_partition test setup. Available values are (DeltaType.APPEND, DeltaType.UPSERT, DeltaType.DELETE). DeltaType.APPEND is not supported by compactor v1 or v2
55
55
  expected_terminal_compact_partition_result: pa.Table - expected PyArrow table after compaction (i.e,. the state of the table after applying all row UPDATES/DELETES/INSERTS)
56
56
  expected_terminal_exception: BaseException - expected exception during compaction
57
+ expected_terminal_exception_message: Optional[str] - expected exception message if present.
57
58
  do_create_placement_group: bool - toggles whether to create a placement group (https://docs.ray.io/en/latest/ray-core/scheduling/placement-group.html) or not
58
59
  records_per_compacted_file: int - argument for the records_per_compacted_file parameter in compact_partition
59
60
  hash_bucket_count_param: int - argument for the hash_bucket_count parameter in compact_partition
@@ -70,6 +71,7 @@ class BaseCompactorTestCase:
70
71
  input_deltas_delta_type: DeltaType
71
72
  expected_terminal_compact_partition_result: pa.Table
72
73
  expected_terminal_exception: BaseException
74
+ expected_terminal_exception_message: str
73
75
  do_create_placement_group: bool
74
76
  records_per_compacted_file: int
75
77
  hash_bucket_count: int
@@ -84,7 +86,12 @@ class BaseCompactorTestCase:
84
86
 
85
87
  @dataclass(frozen=True)
86
88
  class IncrementalCompactionTestCaseParams(BaseCompactorTestCase):
87
- pass
89
+ """
90
+ Args:
91
+ is_inplace: bool - argument to indicate whether to try compacting an in-place compacted table (the source table is the destination table). Also needed to control whether the destination table is created
92
+ """
93
+
94
+ is_inplace: bool
88
95
 
89
96
 
90
97
  @dataclass(frozen=True)
@@ -134,11 +141,13 @@ INCREMENTAL_TEST_CASES: Dict[str, IncrementalCompactionTestCaseParams] = {
134
141
  names=["pk_col_1"],
135
142
  ),
136
143
  expected_terminal_exception=None,
144
+ expected_terminal_exception_message=None,
137
145
  do_create_placement_group=False,
138
146
  records_per_compacted_file=DEFAULT_MAX_RECORDS_PER_FILE,
139
147
  hash_bucket_count=DEFAULT_HASH_BUCKET_COUNT,
140
148
  read_kwargs_provider=None,
141
149
  drop_duplicates=True,
150
+ is_inplace=False,
142
151
  skip_enabled_compact_partition_drivers=None,
143
152
  ),
144
153
  "2-incremental-pkstr-skstr-norcf": IncrementalCompactionTestCaseParams(
@@ -159,11 +168,13 @@ INCREMENTAL_TEST_CASES: Dict[str, IncrementalCompactionTestCaseParams] = {
159
168
  names=["pk_col_1", "sk_col_1"],
160
169
  ),
161
170
  expected_terminal_exception=None,
171
+ expected_terminal_exception_message=None,
162
172
  do_create_placement_group=False,
163
173
  records_per_compacted_file=DEFAULT_MAX_RECORDS_PER_FILE,
164
174
  hash_bucket_count=DEFAULT_HASH_BUCKET_COUNT,
165
175
  read_kwargs_provider=None,
166
176
  drop_duplicates=True,
177
+ is_inplace=False,
167
178
  skip_enabled_compact_partition_drivers=None,
168
179
  ),
169
180
  "3-incremental-pkstr-multiskstr-norcf": IncrementalCompactionTestCaseParams(
@@ -193,11 +204,13 @@ INCREMENTAL_TEST_CASES: Dict[str, IncrementalCompactionTestCaseParams] = {
193
204
  names=["pk_col_1", "sk_col_1", "sk_col_2"],
194
205
  ),
195
206
  expected_terminal_exception=None,
207
+ expected_terminal_exception_message=None,
196
208
  do_create_placement_group=False,
197
209
  records_per_compacted_file=DEFAULT_MAX_RECORDS_PER_FILE,
198
210
  hash_bucket_count=DEFAULT_HASH_BUCKET_COUNT,
199
211
  read_kwargs_provider=None,
200
212
  drop_duplicates=True,
213
+ is_inplace=False,
201
214
  skip_enabled_compact_partition_drivers=None,
202
215
  ),
203
216
  "4-incremental-duplicate-pk": IncrementalCompactionTestCaseParams(
@@ -226,11 +239,13 @@ INCREMENTAL_TEST_CASES: Dict[str, IncrementalCompactionTestCaseParams] = {
226
239
  names=["pk_col_1", "sk_col_1", "sk_col_2"],
227
240
  ),
228
241
  expected_terminal_exception=None,
242
+ expected_terminal_exception_message=None,
229
243
  do_create_placement_group=False,
230
244
  records_per_compacted_file=DEFAULT_MAX_RECORDS_PER_FILE,
231
245
  hash_bucket_count=DEFAULT_HASH_BUCKET_COUNT,
232
246
  read_kwargs_provider=None,
233
247
  drop_duplicates=True,
248
+ is_inplace=False,
234
249
  skip_enabled_compact_partition_drivers=None,
235
250
  ),
236
251
  "5-incremental-decimal-pk-simple": IncrementalCompactionTestCaseParams(
@@ -254,11 +269,13 @@ INCREMENTAL_TEST_CASES: Dict[str, IncrementalCompactionTestCaseParams] = {
254
269
  names=["pk_col_1", "sk_col_1"],
255
270
  ),
256
271
  expected_terminal_exception=None,
272
+ expected_terminal_exception_message=None,
257
273
  do_create_placement_group=False,
258
274
  records_per_compacted_file=DEFAULT_MAX_RECORDS_PER_FILE,
259
275
  hash_bucket_count=DEFAULT_HASH_BUCKET_COUNT,
260
276
  read_kwargs_provider=None,
261
277
  drop_duplicates=True,
278
+ is_inplace=False,
262
279
  skip_enabled_compact_partition_drivers=None,
263
280
  ),
264
281
  "6-incremental-integer-pk-simple": IncrementalCompactionTestCaseParams(
@@ -282,11 +299,13 @@ INCREMENTAL_TEST_CASES: Dict[str, IncrementalCompactionTestCaseParams] = {
282
299
  names=["pk_col_1", "sk_col_1"],
283
300
  ),
284
301
  expected_terminal_exception=None,
302
+ expected_terminal_exception_message=None,
285
303
  do_create_placement_group=False,
286
304
  records_per_compacted_file=DEFAULT_MAX_RECORDS_PER_FILE,
287
305
  hash_bucket_count=DEFAULT_HASH_BUCKET_COUNT,
288
306
  read_kwargs_provider=None,
289
307
  drop_duplicates=True,
308
+ is_inplace=False,
290
309
  skip_enabled_compact_partition_drivers=None,
291
310
  ),
292
311
  "7-incremental-timestamp-pk-simple": IncrementalCompactionTestCaseParams(
@@ -310,11 +329,13 @@ INCREMENTAL_TEST_CASES: Dict[str, IncrementalCompactionTestCaseParams] = {
310
329
  names=["pk_col_1", "sk_col_1"],
311
330
  ),
312
331
  expected_terminal_exception=None,
332
+ expected_terminal_exception_message=None,
313
333
  do_create_placement_group=False,
314
334
  records_per_compacted_file=DEFAULT_MAX_RECORDS_PER_FILE,
315
335
  hash_bucket_count=DEFAULT_HASH_BUCKET_COUNT,
316
336
  read_kwargs_provider=None,
317
337
  drop_duplicates=True,
338
+ is_inplace=False,
318
339
  skip_enabled_compact_partition_drivers=None,
319
340
  ),
320
341
  "8-incremental-decimal-timestamp-pk-multi": IncrementalCompactionTestCaseParams(
@@ -340,11 +361,13 @@ INCREMENTAL_TEST_CASES: Dict[str, IncrementalCompactionTestCaseParams] = {
340
361
  names=["pk_col_1", "pk_col_2", "sk_col_1"],
341
362
  ),
342
363
  expected_terminal_exception=None,
364
+ expected_terminal_exception_message=None,
343
365
  do_create_placement_group=False,
344
366
  records_per_compacted_file=DEFAULT_MAX_RECORDS_PER_FILE,
345
367
  hash_bucket_count=DEFAULT_HASH_BUCKET_COUNT,
346
368
  read_kwargs_provider=None,
347
369
  drop_duplicates=True,
370
+ is_inplace=False,
348
371
  skip_enabled_compact_partition_drivers=None,
349
372
  ),
350
373
  "9-incremental-decimal-pk-multi-dup": IncrementalCompactionTestCaseParams(
@@ -368,11 +391,13 @@ INCREMENTAL_TEST_CASES: Dict[str, IncrementalCompactionTestCaseParams] = {
368
391
  names=["pk_col_1", "sk_col_1"],
369
392
  ),
370
393
  expected_terminal_exception=None,
394
+ expected_terminal_exception_message=None,
371
395
  do_create_placement_group=False,
372
396
  records_per_compacted_file=DEFAULT_MAX_RECORDS_PER_FILE,
373
397
  hash_bucket_count=DEFAULT_HASH_BUCKET_COUNT,
374
398
  read_kwargs_provider=None,
375
399
  drop_duplicates=True,
400
+ is_inplace=False,
376
401
  skip_enabled_compact_partition_drivers=None,
377
402
  ),
378
403
  "10-incremental-decimal-pk-partitionless": IncrementalCompactionTestCaseParams(
@@ -396,11 +421,13 @@ INCREMENTAL_TEST_CASES: Dict[str, IncrementalCompactionTestCaseParams] = {
396
421
  names=["pk_col_1", "sk_col_1"],
397
422
  ),
398
423
  expected_terminal_exception=None,
424
+ expected_terminal_exception_message=None,
399
425
  do_create_placement_group=False,
400
426
  records_per_compacted_file=DEFAULT_MAX_RECORDS_PER_FILE,
401
427
  hash_bucket_count=DEFAULT_HASH_BUCKET_COUNT,
402
428
  read_kwargs_provider=None,
403
429
  drop_duplicates=True,
430
+ is_inplace=False,
404
431
  skip_enabled_compact_partition_drivers=None,
405
432
  ),
406
433
  "11-incremental-decimal-hash-bucket-single": IncrementalCompactionTestCaseParams(
@@ -424,11 +451,13 @@ INCREMENTAL_TEST_CASES: Dict[str, IncrementalCompactionTestCaseParams] = {
424
451
  names=["pk_col_1", "sk_col_1"],
425
452
  ),
426
453
  expected_terminal_exception=None,
454
+ expected_terminal_exception_message=None,
427
455
  do_create_placement_group=False,
428
456
  records_per_compacted_file=DEFAULT_MAX_RECORDS_PER_FILE,
429
457
  hash_bucket_count=DEFAULT_HASH_BUCKET_COUNT,
430
458
  read_kwargs_provider=None,
431
459
  drop_duplicates=True,
460
+ is_inplace=False,
432
461
  skip_enabled_compact_partition_drivers=None,
433
462
  ),
434
463
  "12-incremental-decimal-single-hash-bucket": IncrementalCompactionTestCaseParams(
@@ -452,13 +481,45 @@ INCREMENTAL_TEST_CASES: Dict[str, IncrementalCompactionTestCaseParams] = {
452
481
  names=["pk_col_1", "sk_col_1"],
453
482
  ),
454
483
  expected_terminal_exception=None,
484
+ expected_terminal_exception_message=None,
455
485
  do_create_placement_group=False,
456
486
  records_per_compacted_file=DEFAULT_MAX_RECORDS_PER_FILE,
457
487
  hash_bucket_count=1,
458
488
  read_kwargs_provider=None,
459
489
  drop_duplicates=True,
490
+ is_inplace=False,
460
491
  skip_enabled_compact_partition_drivers=None,
461
492
  ),
493
+ "13-incremental-pkstr-skexists-isinplacecompacted": IncrementalCompactionTestCaseParams(
494
+ primary_keys={"pk_col_1"},
495
+ sort_keys=[SortKey.of(key_name="sk_col_1")],
496
+ partition_keys=[PartitionKey.of("region_id", PartitionKeyType.INT)],
497
+ partition_values=["1"],
498
+ input_deltas=pa.Table.from_arrays(
499
+ [
500
+ pa.array([str(i) for i in range(10)]),
501
+ pa.array([i for i in range(10)]),
502
+ ],
503
+ names=["pk_col_1", "sk_col_1"],
504
+ ),
505
+ input_deltas_delta_type=DeltaType.UPSERT,
506
+ expected_terminal_compact_partition_result=pa.Table.from_arrays(
507
+ [
508
+ pa.array([str(i) for i in range(10)]),
509
+ pa.array([i for i in range(10)]),
510
+ ],
511
+ names=["pk_col_1", "sk_col_1"],
512
+ ),
513
+ expected_terminal_exception=None,
514
+ expected_terminal_exception_message=None,
515
+ do_create_placement_group=False,
516
+ records_per_compacted_file=DEFAULT_MAX_RECORDS_PER_FILE,
517
+ hash_bucket_count=DEFAULT_HASH_BUCKET_COUNT,
518
+ read_kwargs_provider=None,
519
+ drop_duplicates=True,
520
+ is_inplace=True,
521
+ skip_enabled_compact_partition_drivers=[CompactorVersion.V1],
522
+ ),
462
523
  }
463
524
 
464
525
  INCREMENTAL_TEST_CASES = with_compactor_version_func_test_param(INCREMENTAL_TEST_CASES)
@@ -24,6 +24,9 @@ from deltacat.tests.compute.test_util_constant import (
24
24
  DEFAULT_NUM_WORKERS,
25
25
  DEFAULT_WORKER_INSTANCE_CPUS,
26
26
  )
27
+ from deltacat.compute.compactor import (
28
+ RoundCompletionInfo,
29
+ )
27
30
 
28
31
  DATABASE_FILE_PATH_KEY, DATABASE_FILE_PATH_VALUE = (
29
32
  "db_file_path",
@@ -101,12 +104,14 @@ def offer_local_deltacat_storage_kwargs(request: pytest.FixtureRequest):
101
104
  "input_deltas_delta_type",
102
105
  "expected_terminal_compact_partition_result",
103
106
  "expected_terminal_exception",
107
+ "expected_terminal_exception_message",
104
108
  "create_placement_group_param",
105
109
  "records_per_compacted_file_param",
106
110
  "hash_bucket_count_param",
107
111
  "read_kwargs_provider_param",
108
112
  "drop_duplicates_param",
109
113
  "skip_enabled_compact_partition_drivers",
114
+ "is_inplace",
110
115
  "compact_partition_func",
111
116
  ],
112
117
  [
@@ -120,12 +125,14 @@ def offer_local_deltacat_storage_kwargs(request: pytest.FixtureRequest):
120
125
  input_deltas_delta_type,
121
126
  expected_terminal_compact_partition_result,
122
127
  expected_terminal_exception,
128
+ expected_terminal_exception_message,
123
129
  create_placement_group_param,
124
130
  records_per_compacted_file_param,
125
131
  hash_bucket_count_param,
126
132
  drop_duplicates_param,
127
133
  read_kwargs_provider,
128
134
  skip_enabled_compact_partition_drivers,
135
+ is_inplace,
129
136
  compact_partition_func,
130
137
  )
131
138
  for test_name, (
@@ -137,17 +144,18 @@ def offer_local_deltacat_storage_kwargs(request: pytest.FixtureRequest):
137
144
  input_deltas_delta_type,
138
145
  expected_terminal_compact_partition_result,
139
146
  expected_terminal_exception,
147
+ expected_terminal_exception_message,
140
148
  create_placement_group_param,
141
149
  records_per_compacted_file_param,
142
150
  hash_bucket_count_param,
143
151
  drop_duplicates_param,
144
152
  read_kwargs_provider,
145
153
  skip_enabled_compact_partition_drivers,
154
+ is_inplace,
146
155
  compact_partition_func,
147
156
  ) in INCREMENTAL_TEST_CASES.items()
148
157
  ],
149
158
  ids=[test_name for test_name in INCREMENTAL_TEST_CASES],
150
- indirect=[],
151
159
  )
152
160
  def test_compact_partition_incremental(
153
161
  setup_s3_resource: ServiceResource,
@@ -161,12 +169,14 @@ def test_compact_partition_incremental(
161
169
  input_deltas_delta_type: str,
162
170
  expected_terminal_compact_partition_result: pa.Table,
163
171
  expected_terminal_exception: BaseException,
172
+ expected_terminal_exception_message: Optional[str],
164
173
  create_placement_group_param: bool,
165
174
  records_per_compacted_file_param: int,
166
175
  hash_bucket_count_param: int,
167
176
  drop_duplicates_param: bool,
168
177
  read_kwargs_provider_param: Any,
169
178
  skip_enabled_compact_partition_drivers,
179
+ is_inplace: bool,
170
180
  compact_partition_func: Callable,
171
181
  benchmark: BenchmarkFixture,
172
182
  ):
@@ -174,6 +184,7 @@ def test_compact_partition_incremental(
174
184
  from deltacat.types.media import ContentType
175
185
  from deltacat.storage import (
176
186
  DeltaLocator,
187
+ Partition,
177
188
  PartitionLocator,
178
189
  )
179
190
  from deltacat.compute.compactor.model.compaction_session_audit_info import (
@@ -186,7 +197,7 @@ def test_compact_partition_incremental(
186
197
  PlacementGroupManager,
187
198
  )
188
199
 
189
- ds_mock_kwargs = offer_local_deltacat_storage_kwargs
200
+ ds_mock_kwargs: Dict[str, Any] = offer_local_deltacat_storage_kwargs
190
201
 
191
202
  # setup
192
203
  partition_keys = partition_keys_param
@@ -202,20 +213,21 @@ def test_compact_partition_incremental(
202
213
  input_deltas_delta_type,
203
214
  partition_values_param,
204
215
  ds_mock_kwargs,
216
+ is_inplace,
205
217
  )
206
- source_partition = ds.get_partition(
218
+ source_partition: Partition = ds.get_partition(
207
219
  source_table_stream.locator,
208
220
  partition_values_param,
209
221
  **ds_mock_kwargs,
210
222
  )
211
- destination_partition_locator = PartitionLocator.of(
223
+ destination_partition_locator: PartitionLocator = PartitionLocator.of(
212
224
  destination_table_stream.locator,
213
225
  partition_values_param,
214
226
  None,
215
227
  )
216
228
  num_workers, worker_instance_cpu = DEFAULT_NUM_WORKERS, DEFAULT_WORKER_INSTANCE_CPUS
217
- total_cpus = num_workers * worker_instance_cpu
218
- pgm = None
229
+ total_cpus: int = num_workers * worker_instance_cpu
230
+ pgm: Optional[PlacementGroupManager] = None
219
231
  if create_placement_group_param:
220
232
  pgm = PlacementGroupManager(
221
233
  1, total_cpus, worker_instance_cpu, memory_per_bundle=4000000
@@ -260,14 +272,16 @@ def test_compact_partition_incremental(
260
272
  compact_partition_func, setup=_incremental_compaction_setup
261
273
  )
262
274
  # validate
263
- round_completion_info = get_rcf(setup_s3_resource, rcf_file_s3_uri)
275
+ round_completion_info: RoundCompletionInfo = get_rcf(
276
+ setup_s3_resource, rcf_file_s3_uri
277
+ )
264
278
  compacted_delta_locator: DeltaLocator = (
265
279
  round_completion_info.compacted_delta_locator
266
280
  )
267
281
  audit_bucket, audit_key = round_completion_info.compaction_audit_url.replace(
268
282
  "s3://", ""
269
283
  ).split("/", 1)
270
- compaction_audit_obj: dict = read_s3_contents(
284
+ compaction_audit_obj: Dict[str, Any] = read_s3_contents(
271
285
  setup_s3_resource, audit_bucket, audit_key
272
286
  )
273
287
  compaction_audit: CompactionSessionAuditInfo = CompactionSessionAuditInfo(
@@ -281,7 +295,7 @@ def test_compact_partition_incremental(
281
295
  sorting_cols: List[Any] = [(val, "ascending") for val in primary_keys]
282
296
  # the compacted table may contain multiple files and chunks
283
297
  # and order of records may be incorrect due to multiple files.
284
- expected_terminal_compact_partition_result = (
298
+ expected_terminal_compact_partition_result: pa.Table = (
285
299
  expected_terminal_compact_partition_result.combine_chunks().sort_by(
286
300
  sorting_cols
287
301
  )
@@ -297,4 +311,15 @@ def test_compact_partition_incremental(
297
311
  assert actual_compacted_table.equals(
298
312
  expected_terminal_compact_partition_result
299
313
  ), f"{actual_compacted_table} does not match {expected_terminal_compact_partition_result}"
314
+
315
+ if is_inplace:
316
+ assert (
317
+ source_partition.locator.partition_values
318
+ == destination_partition_locator.partition_values
319
+ and source_partition.locator.stream_id
320
+ == destination_partition_locator.stream_id
321
+ ), "The source partition should match the destination partition"
322
+ assert (
323
+ compacted_delta_locator.stream_id == source_partition.locator.stream_id
324
+ ), "The compacted delta should be in the same stream as the source"
300
325
  return
@@ -115,6 +115,7 @@ def local_deltacat_storage_kwargs(request: pytest.FixtureRequest):
115
115
  "input_deltas_delta_type",
116
116
  "expected_terminal_compact_partition_result",
117
117
  "expected_terminal_exception",
118
+ "expected_terminal_exception_message",
118
119
  "create_placement_group_param",
119
120
  "records_per_compacted_file_param",
120
121
  "hash_bucket_count_param",
@@ -136,6 +137,7 @@ def local_deltacat_storage_kwargs(request: pytest.FixtureRequest):
136
137
  input_deltas_delta_type,
137
138
  expected_terminal_compact_partition_result,
138
139
  expected_terminal_exception,
140
+ expected_terminal_exception_message,
139
141
  create_placement_group_param,
140
142
  records_per_compacted_file_param,
141
143
  hash_bucket_count_param,
@@ -155,6 +157,7 @@ def local_deltacat_storage_kwargs(request: pytest.FixtureRequest):
155
157
  input_deltas_delta_type,
156
158
  expected_terminal_compact_partition_result,
157
159
  expected_terminal_exception,
160
+ expected_terminal_exception_message,
158
161
  create_placement_group_param,
159
162
  records_per_compacted_file_param,
160
163
  hash_bucket_count_param,
@@ -180,6 +183,7 @@ def test_compact_partition_rebase_then_incremental(
180
183
  input_deltas_delta_type: str,
181
184
  expected_terminal_compact_partition_result: pa.Table,
182
185
  expected_terminal_exception: BaseException,
186
+ expected_terminal_exception_message: Optional[str],
183
187
  create_placement_group_param: bool,
184
188
  records_per_compacted_file_param: int,
185
189
  hash_bucket_count_param: int,
@@ -337,8 +341,9 @@ def test_compact_partition_rebase_then_incremental(
337
341
  }
338
342
  )
339
343
  if expected_terminal_exception:
340
- with pytest.raises(expected_terminal_exception):
344
+ with pytest.raises(expected_terminal_exception) as exc_info:
341
345
  compact_partition_func(compact_partition_params)
346
+ assert expected_terminal_exception_message in str(exc_info.value)
342
347
  return
343
348
  rcf_file_s3_uri = compact_partition_func(compact_partition_params)
344
349
  round_completion_info = get_rcf(setup_s3_resource, rcf_file_s3_uri)
@@ -20,6 +20,9 @@ from deltacat.tests.compute.test_util_constant import (
20
20
  REBASING_TABLE_NAME,
21
21
  REBASING_TABLE_VERSION,
22
22
  )
23
+ from deltacat.compute.compactor import (
24
+ RoundCompletionInfo,
25
+ )
23
26
 
24
27
 
25
28
  class PartitionKeyType(str, Enum):
@@ -134,11 +137,8 @@ def create_rebase_table(
134
137
  )
135
138
 
136
139
 
137
- def get_rcf(s3_resource, rcf_file_s3_uri: str):
140
+ def get_rcf(s3_resource, rcf_file_s3_uri: str) -> RoundCompletionInfo:
138
141
  from deltacat.tests.test_utils.utils import read_s3_contents
139
- from deltacat.compute.compactor import (
140
- RoundCompletionInfo,
141
- )
142
142
 
143
143
  _, rcf_object_key = rcf_file_s3_uri.rsplit("/", 1)
144
144
  rcf_file_output: Dict[str, Any] = read_s3_contents(