nssalian commented on code in PR #2620:
URL: https://github.com/apache/iceberg-go/pull/2620#discussion_r4606118323


##########
table/partition_promotion_deletes_test.go:
##########
@@ -0,0 +1,152 @@
+// 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 (
+       "context"
+       "path/filepath"
+       "testing"
+
+       "github.com/apache/arrow-go/v18/arrow/array"
+       "github.com/apache/arrow-go/v18/arrow/memory"
+       "github.com/apache/iceberg-go"
+       iceio "github.com/apache/iceberg-go/io"
+       "github.com/apache/iceberg-go/table"
+       "github.com/stretchr/testify/assert"
+       "github.com/stretchr/testify/require"
+)
+
+// newPromotablePartitionTable builds a table identity-partitioned on a
+// promotable column "p", so manifests written before and after promoting p
+// decode its partition values with different Go widths.
+func newPromotablePartitionTable(t *testing.T, formatVersion string, partType 
iceberg.Type) *table.Table {
+       t.Helper()
+
+       location := filepath.ToSlash(t.TempDir())
+       schema := iceberg.NewSchema(0,
+               iceberg.NestedField{ID: 1, Name: "id", Type: 
iceberg.PrimitiveTypes.Int64, Required: true},
+               iceberg.NestedField{ID: 2, Name: "p", Type: partType, Required: 
false},
+       )
+       spec := iceberg.NewPartitionSpec(
+               iceberg.PartitionField{SourceIDs: []int{2}, FieldID: 1000, 
Name: "p", Transform: iceberg.IdentityTransform{}},
+       )
+       meta, err := table.NewMetadata(schema, &spec, table.UnsortedSortOrder, 
location,
+               iceberg.Properties{
+                       table.PropertyFormatVersion: formatVersion,
+                       table.WriteDeleteModeKey:    table.WriteModeMergeOnRead,
+               })
+       require.NoError(t, err)
+
+       metaLoc := location + "/metadata/v1.metadata.json"
+       fsF := func(context.Context) (iceio.IO, error) { return 
iceio.LocalFS{}, nil }
+       cat := &concurrentTestCatalog{metadata: meta, location: metaLoc, fsF: 
fsF}
+
+       return table.New(table.Identifier{"db", "partition_promotion"}, meta, 
metaLoc, fsF, cat)
+}
+
+func appendPromotionRows(t *testing.T, tbl *table.Table, rows string) 
*table.Table {

Review Comment:
   `appendPromotionRows` does the same thing as the existing `appendRows` 
helper in `cow_rewrite_deletes_test.go:408`: it builds an Arrow table from the 
JSON rows using the table's own schema, then calls `tbl.Append`. Both files are 
in `package table_test`, so the two call sites (lines 115 and 134) can use 
`appendRows` directly and this helper can be removed.



-- 
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