tanmayrauth commented on code in PR #890:
URL: https://github.com/apache/iceberg-go/pull/890#discussion_r3088928180
##########
manifest.go:
##########
@@ -537,27 +485,37 @@ type ManifestFile interface {
setVersion(int)
}
-type fallbackManifest[T any] interface {
- ManifestFile
- toFile() *manifestFile
- *T
-}
-
-func decodeManifestsWithFallback[P fallbackManifest[T], T any](rd *ocf.Reader)
([]ManifestFile, error) {
- results := make([]ManifestFile, 0)
- for {
- tmp := P(new(T))
- if err := rd.Decode(tmp); err != nil {
- if errors.Is(err, io.EOF) {
- return results, nil
- }
-
- return nil, err
- }
+// fieldSummarySchemaNode is the FieldSummary Avro schema with "r508" as an
+// alias. The alias lets avro.Resolve match the record name used by the
+// internal manifest list schemas.
+var fieldSummarySchemaNode = func() avro.SchemaNode {
+ n := avro.MustSchemaFor[FieldSummary]().Root()
+ n.Aliases = []string{"r508"}
+
+ return n
+}()
+
+// manifestFileV1Reader is the Avro reader schema for V1 manifest list entries.
+// It handles both spec-correct field names and pre-1.4 Java Iceberg legacy
+// names (added_data_files_count etc.) via the alias tags on manifestFileV1,
+// and both nullable and non-nullable added_snapshot_id via *int64.
+var manifestFileV1Reader = avro.MustSchemaFor[manifestFileV1](
+ avro.WithName("manifest_file"),
+ avro.CustomType{
+ GoType: reflect.TypeOf(FieldSummary{}),
+ Schema: &fieldSummarySchemaNode,
+ },
Review Comment:
I got it updated
--
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]