dwilson1988 commented on code in PR #177: URL: https://github.com/apache/iceberg-go/pull/177#discussion_r1813467513
########## 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, so it does not look like using `avro.NewEncoderWithSchema` works here (nor does is accept the codec/format-version options or, from what I understand, the ability to add metadata. It's not clear to me what to do here. -- 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