dwilson1988 commented on code in PR #177: URL: https://github.com/apache/iceberg-go/pull/177#discussion_r1813442346
########## manifest.go: ########## @@ -567,6 +569,96 @@ func ReadManifestList(in io.Reader) ([]ManifestFile, error) { return out, dec.Error() } +// WriteManifestListV2 writes a list of v2 manifest files to an avro file. +func WriteManifestListV2(out io.Writer, files []ManifestFile) error { + return writeManifestList(out, files, 2) +} + +// WriteManifestListV1 writes a list of v1 manifest files to an avro file. +func WriteManifestListV1(out io.Writer, files []ManifestFile) error { + return writeManifestList(out, files, 1) +} + +func writeManifestList(out io.Writer, files []ManifestFile, version int) error { + for _, file := range files { + if file.Version() != version { + return ErrInvalidArgument + } + } + + var key string + switch version { + case 1: + key = internal.ManifestListV1Key + case 2: + key = internal.ManifestListV2Key + default: + return ErrInvalidArgument + } + + enc, err := ocf.NewEncoder( + internal.AvroSchemaCache.Get(key).String(), Review Comment: Hmm, I thought we needed the schemas here because of the field-ids, but I have very little avro experience, so I'll defer to you. -- 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: issues-unsubscr...@iceberg.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For additional commands, e-mail: issues-h...@iceberg.apache.org