@@ -79,13 +79,11 @@ public void testDataFilters() {
79
79
sql ("INSERT INTO %s VALUES (1, 'c'), (2, 'c'), (3, 'c')" , tableName );
80
80
81
81
Table table = validationCatalog .loadTable (tableIdent );
82
-
83
82
Snapshot snap1 = table .currentSnapshot ();
84
83
85
84
sql ("DELETE FROM %s WHERE id = 3" , tableName );
86
85
87
86
table .refresh ();
88
-
89
87
Snapshot snap2 = table .currentSnapshot ();
90
88
91
89
assertEquals (
@@ -123,13 +121,11 @@ public void testUpdates() {
123
121
createTableWithDefaultRows ();
124
122
125
123
Table table = validationCatalog .loadTable (tableIdent );
126
-
127
124
Snapshot snap2 = table .currentSnapshot ();
128
125
129
126
sql ("UPDATE %s SET id = -2 WHERE data = 'b'" , tableName );
130
127
131
128
table .refresh ();
132
-
133
129
Snapshot snap3 = table .currentSnapshot ();
134
130
135
131
assertEquals (
@@ -295,6 +291,52 @@ public void testManifestRewritesAreIgnored() {
295
291
sql ("SELECT id, _change_type FROM %s.changes ORDER BY id" , tableName ));
296
292
}
297
293
294
+ @ TestTemplate
295
+ public void testDataRewritesAreIgnored () {
296
+ createTable ();
297
+ sql ("INSERT INTO %s VALUES (1, 'c'), (2, 'c'), (3, 'c')" , tableName );
298
+
299
+ Table table = validationCatalog .loadTable (tableIdent );
300
+ Snapshot snap1 = table .currentSnapshot ();
301
+
302
+ sql ("DELETE FROM %s WHERE id = 3" , tableName );
303
+
304
+ table .refresh ();
305
+ Snapshot snap2 = table .currentSnapshot ();
306
+
307
+ sql ("CALL %s.system.rewrite_data_files('%s')" , catalogName , tableIdent );
308
+
309
+ sql ("DELETE FROM %s WHERE id = 1" , tableName );
310
+
311
+ table .refresh ();
312
+ Snapshot snap3 = table .currentSnapshot ();
313
+
314
+ List <Object []> expectedRows =
315
+ (formatVersion == 1 )
316
+ ? ImmutableList .of (
317
+ row (1 , "c" , "INSERT" , 0 , snap1 .snapshotId ()),
318
+ row (2 , "c" , "INSERT" , 0 , snap1 .snapshotId ()),
319
+ row (3 , "c" , "INSERT" , 0 , snap1 .snapshotId ()),
320
+ row (1 , "c" , "DELETE" , 1 , snap1 .snapshotId ()),
321
+ row (1 , "c" , "INSERT" , 1 , snap1 .snapshotId ()),
322
+ row (2 , "c" , "DELETE" , 1 , snap1 .snapshotId ()),
323
+ row (2 , "c" , "INSERT" , 1 , snap1 .snapshotId ()),
324
+ row (3 , "c" , "DELETE" , 1 , snap2 .snapshotId ()),
325
+ row (1 , "c" , "DELETE" , 2 , snap3 .snapshotId ()),
326
+ row (2 , "c" , "DELETE" , 2 , snap1 .snapshotId ()),
327
+ row (2 , "c" , "INSERT" , 2 , snap1 .snapshotId ()))
328
+ : ImmutableList .of (
329
+ row (1 , "c" , "INSERT" , 0 , snap1 .snapshotId ()),
330
+ row (2 , "c" , "INSERT" , 0 , snap1 .snapshotId ()),
331
+ row (3 , "c" , "INSERT" , 0 , snap1 .snapshotId ()),
332
+ row (3 , "c" , "DELETE" , 1 , snap2 .snapshotId ()),
333
+ row (1 , "c" , "DELETE" , 2 , snap3 .snapshotId ()));
334
+ assertEquals (
335
+ "Should have expected rows" ,
336
+ expectedRows ,
337
+ sql ("SELECT * FROM %s.changes ORDER BY _change_ordinal, id, _change_type" , tableName ));
338
+ }
339
+
298
340
@ TestTemplate
299
341
public void testMetadataColumns () {
300
342
createTableWithDefaultRows ();
0 commit comments