Skip to content

Commit 1114e38

Browse files
authored
fix(table): error formatting (#747)
related to #723 Signed-off-by: ferhat elmas <elmas.ferhat@gmail.com>
1 parent 67950ca commit 1114e38

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

table/transaction.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -439,9 +439,6 @@ func (t *Transaction) ReplaceDataFiles(ctx context.Context, filesToDelete, files
439439
// the current partition spec fields by ID without reading file contents.
440440
func validateDataFilePartitionData(df iceberg.DataFile, spec *iceberg.PartitionSpec) error {
441441
partitionData := df.Partition()
442-
if partitionData == nil {
443-
partitionData = map[int]any{}
444-
}
445442

446443
expectedFieldIDs := make(map[int]string)
447444
for field := range spec.Fields() {
@@ -464,9 +461,12 @@ func validateDataFilePartitionData(df iceberg.DataFile, spec *iceberg.PartitionS
464461
// DataFiles and returns a set of paths that passed validation.
465462
func (t *Transaction) validateDataFilesToAdd(dataFiles []iceberg.DataFile, operation string) (map[string]struct{}, error) {
466463
currentSpec, err := t.meta.CurrentSpec()
467-
if err != nil || currentSpec == nil {
464+
if err != nil {
468465
return nil, fmt.Errorf("could not get current partition spec: %w", err)
469466
}
467+
if currentSpec == nil {
468+
return nil, errors.New("could not get current partition spec: no current partition spec found")
469+
}
470470

471471
expectedSpecID := int32(currentSpec.ID())
472472
setToAdd := make(map[string]struct{}, len(dataFiles))
@@ -546,7 +546,7 @@ func (t *Transaction) AddDataFiles(ctx context.Context, dataFiles []iceberg.Data
546546
}
547547

548548
if len(referenced) > 0 {
549-
return fmt.Errorf("cannot add files that are already referenced by table, files: %s", referenced)
549+
return fmt.Errorf("cannot add files that are already referenced by table, files: %v", referenced)
550550
}
551551
}
552552

@@ -710,7 +710,7 @@ func (t *Transaction) AddFiles(ctx context.Context, files []string, snapshotProp
710710
}
711711
}
712712
if len(referenced) > 0 {
713-
return fmt.Errorf("cannot add files that are already referenced by table, files: %s", referenced)
713+
return fmt.Errorf("cannot add files that are already referenced by table, files: %v", referenced)
714714
}
715715
}
716716
}

0 commit comments

Comments
 (0)