badalprasadsingh commented on code in PR #2046:
URL: https://github.com/apache/iceberg-go/pull/2046#discussion_r4263708621


##########
table/cow_rewrite_deletes_test.go:
##########
@@ -0,0 +1,391 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package table_test
+
+import (
+       "testing"
+
+       "github.com/apache/arrow-go/v18/arrow/array"
+       "github.com/apache/arrow-go/v18/arrow/memory"
+       "github.com/apache/iceberg-go"
+       "github.com/apache/iceberg-go/table"
+       "github.com/stretchr/testify/assert"
+       "github.com/stretchr/testify/require"
+)
+
+type cowRewriteOp struct {
+       name        string
+       run         func(*testing.T, *table.Table) *table.Table
+       wantIDs     []int64
+       wantRecords int64
+}
+
+// TestCoWRewriteKeepsRowsDeleted rewrites a data file that already has a 
delete on id=1.
+// Once the file is replaced that delete no longer reaches the copied rows, so 
the rewrite itself must drop id=1.
+func TestCoWRewriteKeepsRowsDeleted(t *testing.T) {
+       deleteID1 := func(t *testing.T, tbl *table.Table) *table.Table {
+               t.Helper()
+
+               return mergeOnReadDelete(t, tbl, 1)
+       }
+       equalityDeleteID1 := func(t *testing.T, tbl *table.Table) *table.Table {
+               t.Helper()
+
+               return appendEqualityDelete(t, tbl, []int{1}, `[{"id": 1}]`)
+       }
+
+       deletes := []struct {
+               name          string
+               formatVersion string
+               seed          func(*testing.T, *table.Table) *table.Table
+               seededDVs     int
+       }{
+               {name: "position delete", formatVersion: "2", seed: deleteID1},
+               {name: "deletion vector", formatVersion: "3", seed: deleteID1, 
seededDVs: 1},
+               {name: "equality delete on v2", formatVersion: "2", seed: 
equalityDeleteID1},
+               {name: "equality delete on v3", formatVersion: "3", seed: 
equalityDeleteID1},
+       }
+
+       matchID2 := iceberg.EqualTo(iceberg.Reference("id"), int64(2))
+       operations := []cowRewriteOp{

Review Comment:
   added `TestCoWRewriteToEmptyWritesNoDataFile`: table empty, no empty data 
file left live, no DV left.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to