-
Notifications
You must be signed in to change notification settings - Fork 2.9k
[WIP] V4 Manifest Read Support #14533
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
82a4e43
c278fcc
5925ff1
d6302a0
bbb44cb
3ae5e16
2fbd886
8e4849b
cff48fe
e53cbb7
0380105
f278ae4
170d4bf
889db0d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| /* | ||
| * 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 java.nio.ByteBuffer; | ||
| import org.apache.iceberg.types.Types; | ||
|
|
||
| /** | ||
| * Deletion vector information for a tracked file entry in a V4 manifest. | ||
| * | ||
| * <p>This encapsulates both inline and out-of-line deletion vector content. This struct must be | ||
| * defined for types 1 (POSITION_DELETES) and 5 (MANIFEST_DV). | ||
| */ | ||
| public interface DeletionVector { | ||
| Types.NestedField OFFSET = | ||
| Types.NestedField.optional( | ||
| 144, "offset", Types.LongType.get(), "Offset in the file where the content starts"); | ||
| Types.NestedField SIZE_IN_BYTES = | ||
| Types.NestedField.optional( | ||
| 145, | ||
| "size_in_bytes", | ||
| Types.LongType.get(), | ||
| "Length of a referenced content stored in the file; required if offset is present"); | ||
| Types.NestedField INLINE_CONTENT = | ||
| Types.NestedField.optional( | ||
| 146, "inline_content", Types.BinaryType.get(), "Serialized bitmap for inline DVs"); | ||
|
|
||
| /** | ||
| * Returns the offset in the file where the deletion vector content starts. | ||
| * | ||
| * <p>This is used for out-of-line deletion vectors stored in Puffin files. | ||
| */ | ||
| Long offset(); | ||
|
|
||
| /** | ||
| * Returns the size in bytes of the deletion vector content. | ||
| * | ||
| * <p>Required if offset is present. | ||
| */ | ||
| Long sizeInBytes(); | ||
|
|
||
| /** | ||
| * Returns the serialized bitmap for inline deletion vectors. | ||
| * | ||
| * <p>When present, the deletion vector is stored inline in the manifest rather than in a separate | ||
| * Puffin file. | ||
| */ | ||
| ByteBuffer inlineContent(); | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,11 +18,27 @@ | |
| */ | ||
| package org.apache.iceberg; | ||
|
|
||
| /** Content type stored in a file, one of DATA, POSITION_DELETES, or EQUALITY_DELETES. */ | ||
| /** | ||
| * Content type stored in a file. | ||
| * | ||
| * <p>For V1-V3 tables: DATA, POSITION_DELETES, or EQUALITY_DELETES. | ||
| * | ||
| * <p>For V4 tables: DATA, POSITION_DELETES, EQUALITY_DELETES, DATA_MANIFEST, DELETE_MANIFEST, or | ||
| * MANIFEST_DV. | ||
| */ | ||
| public enum FileContent { | ||
| DATA(0), | ||
| POSITION_DELETES(1), | ||
| EQUALITY_DELETES(2); | ||
| EQUALITY_DELETES(2), | ||
| /** Data manifest entry (V4+ only) - references data files in a root manifest. */ | ||
| DATA_MANIFEST(3), | ||
| /** Delete manifest entry (V4+ only) - references delete files in a root manifest. */ | ||
| DELETE_MANIFEST(4), | ||
| /** | ||
| * Manifest deletion vector entry (V4+ only) - marks entries in a manifest as deleted without | ||
| * rewriting the manifest. | ||
| */ | ||
| MANIFEST_DV(5); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I prefer the option of having the DV located in a field of the data or delete manifest record. That way we don't have to wait to find the DV before processing a manifest file. Not sure what others think here, but since the DV metadata/content is likely going to be different between the Metadata DV (inline) and Data DV (stored in Puffin), I don't see much value in trying to reuse metadata fields for it.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That was my preference too, and I advocated for it in our community discussion but this is what we settled on. Our current v4 proposal specifically uses |
||
|
|
||
| private final int id; | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,75 @@ | ||
| /* | ||
| * 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 org.apache.iceberg.types.Types; | ||
|
|
||
| /** | ||
| * Statistics for manifest entries in a V4 tracked file. | ||
| * | ||
| * <p>This encapsulates added/removed/existing files/row counts and min_sequence_number for a | ||
| * manifest. This must be defined when the content_type is a manifest (3 or 4), and null otherwise. | ||
| */ | ||
| public interface ManifestStats { | ||
| Types.NestedField ADDED_FILES_COUNT = | ||
| Types.NestedField.required( | ||
| 504, "added_files_count", Types.IntegerType.get(), "Number of files added"); | ||
| Types.NestedField EXISTING_FILES_COUNT = | ||
| Types.NestedField.required( | ||
| 505, "existing_files_count", Types.IntegerType.get(), "Number of existing files"); | ||
| Types.NestedField DELETED_FILES_COUNT = | ||
| Types.NestedField.required( | ||
| 506, "deleted_files_count", Types.IntegerType.get(), "Number of deleted files"); | ||
| Types.NestedField ADDED_ROWS_COUNT = | ||
| Types.NestedField.required( | ||
| 512, "added_rows_count", Types.LongType.get(), "Number of rows in added files"); | ||
| Types.NestedField EXISTING_ROWS_COUNT = | ||
| Types.NestedField.required( | ||
| 513, "existing_rows_count", Types.LongType.get(), "Number of rows in existing files"); | ||
| Types.NestedField DELETED_ROWS_COUNT = | ||
| Types.NestedField.required( | ||
| 514, "deleted_rows_count", Types.LongType.get(), "Number of rows in deleted files"); | ||
| Types.NestedField MIN_SEQUENCE_NUMBER = | ||
| Types.NestedField.required( | ||
| 516, | ||
| "min_sequence_number", | ||
| Types.LongType.get(), | ||
| "Minimum sequence number of files in this manifest"); | ||
|
|
||
| /** Returns the number of files added by this manifest. */ | ||
| int addedFilesCount(); | ||
|
|
||
| /** Returns the number of existing files referenced by this manifest. */ | ||
| int existingFilesCount(); | ||
|
|
||
| /** Returns the number of deleted files in this manifest. */ | ||
| int deletedFilesCount(); | ||
|
|
||
| /** Returns the number of rows in added files. */ | ||
| long addedRowsCount(); | ||
|
|
||
| /** Returns the number of rows in existing files. */ | ||
| long existingRowsCount(); | ||
|
|
||
| /** Returns the number of rows in deleted files. */ | ||
| long deletedRowsCount(); | ||
|
|
||
| /** Returns the minimum sequence number of files in this manifest. */ | ||
| long minSequenceNumber(); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mentioned this in my comment below, but I don't think there's much value in combining the inline MDV metadata and fields to track data DVs stored in Puffin. These aren't overlapping, so I'd keep them separate.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Data and metadata DVs seemed like similar concepts to me. I can create a separate
ManifestDeletionVector.