@@ -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.
440440func 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.
465462func (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