zeroshade commented on code in PR #177:
URL: https://github.com/apache/iceberg-go/pull/177#discussion_r1813485988


##########
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:
   Why doesn't it work? it accepts the same list of `EncoderFunc` options, so 
the arguments should work identically just removing the `.String()` from the 
first argument.
   
   What happens that fails if you try using `ocf.NewEncoderWithSchema`?



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

Reply via email to