wroever commented on code in PR #1984:
URL: https://github.com/apache/iceberg-go/pull/1984#discussion_r3954459772


##########
data_file_codec_test.go:
##########
@@ -93,6 +93,46 @@ func TestDataFileCodecWithDroppedPartitionSource(t 
*testing.T) {
        require.Equal(t, map[int]any{1000: nil, 1001: int32(3)}, 
decoded.Partition())
 }
 
+func TestUnmarshalAvroDataFileEntryNormalizesFileFormat(t *testing.T) {
+       spec := NewPartitionSpec()
+       schema := NewSchema(0)
+
+       tests := []struct {
+               name          string
+               written       FileFormat
+               expected      FileFormat
+               errorContains string
+       }{
+               {name: "spec lowercase", written: "parquet", expected: 
ParquetFile},
+               {name: "mixed case", written: "Parquet", expected: ParquetFile},
+               {name: "uppercase", written: ParquetFile, expected: 
ParquetFile},
+               {name: "lowercase orc", written: "orc", expected: OrcFile},
+               {name: "unknown format", written: "csv", errorContains: 
"unknown file format: csv"},
+       }

Review Comment:
   👍 Addressed in 
[a2867e3](https://github.com/apache/iceberg-go/pull/1984/commits/a2867e35660ea6728b2cbcd2da62da225594f077).



##########
manifest.go:
##########
@@ -2771,6 +2776,20 @@ func (d *dataFile) setFieldIDToDecimalScaleMap(m 
map[int]int) {
        d.fieldIDToDecimalScale = m
 }
 
+// normalizeFormat sets d.Format to the FileFormat constant matching its
+// decoded spelling, or returns an error if it names no known format.
+// Every Avro decode path must call it before the value is compared or
+// exposed.
+func (d *dataFile) normalizeFormat() error {
+       format, err := FileFormatFromString(string(d.Format))
+       if err != nil {
+               return fmt.Errorf("data file %q has invalid file format: %w", 
d.FilePath(), err)
+       }

Review Comment:
   👍 Addressed in 
[a2867e3](https://github.com/apache/iceberg-go/pull/1984/commits/a2867e35660ea6728b2cbcd2da62da225594f077).



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