You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by GitBox <gi...@apache.org> on 2020/04/14 08:17:27 UTC
[GitHub] [incubator-iceberg] chenjunjiedada commented on a change in pull
request #913: Add v2 manifests (WIP)
chenjunjiedada commented on a change in pull request #913: Add v2 manifests (WIP)
URL: https://github.com/apache/incubator-iceberg/pull/913#discussion_r407950567
##########
File path: core/src/main/java/org/apache/iceberg/ManifestFiles.java
##########
@@ -0,0 +1,94 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.iceberg;
+
+import com.google.common.base.Preconditions;
+import java.util.Map;
+import org.apache.iceberg.io.FileIO;
+import org.apache.iceberg.io.InputFile;
+import org.apache.iceberg.io.OutputFile;
+
+public class ManifestFiles {
+ private ManifestFiles() {
+ }
+
+ /**
+ * Returns a new {@link ManifestReader} for a {@link ManifestFile}.
+ * <p>
+ * <em>Note:</em> Callers should use {@link ManifestFiles#read(ManifestFile, FileIO, Map)} to ensure
+ * the schema used by filters is the latest table schema. This should be used only when reading
+ * a manifest without filters.
+ *
+ * @param manifest a ManifestFile
+ * @param io a FileIO
+ * @return a manifest reader
+ */
+ public static ManifestReader read(ManifestFile manifest, FileIO io) {
+ return read(manifest, io, null);
+ }
+
+ /**
+ * Returns a new {@link ManifestReader} for a {@link ManifestFile}.
+ *
+ * @param manifest a {@link ManifestFile}
+ * @param io a {@link FileIO}
+ * @param specsById a Map from spec ID to partition spec
+ * @return a {@link ManifestReader}
+ */
+ public static ManifestReader read(ManifestFile manifest, FileIO io, Map<Integer, PartitionSpec> specsById) {
+ InputFile file = io.newInputFile(manifest.path());
+ InheritableMetadata inheritableMetadata = InheritableMetadataFactory.fromManifest(manifest);
+ return new ManifestReader(file, specsById, inheritableMetadata);
+ }
+
+ /**
+ * Create a new {@link ManifestWriter}.
+ * <p>
+ * Manifests created by this writer have all entry snapshot IDs set to null.
+ * All entries will inherit the snapshot ID that will be assigned to the manifest on commit.
+ *
+ * @param spec {@link PartitionSpec} used to produce {@link DataFile} partition tuples
+ * @param outputFile the destination file location
+ * @return a manifest writer
+ */
+ public static ManifestWriter write(PartitionSpec spec, OutputFile outputFile) {
Review comment:
The document is duplicated with the one in ManifestWriter.write. We can remove this function definition and just call from there.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org