Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 3.5k
Core: V4 write direction wrappers#16936
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?
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
0c5044c8f39ba332a41afca141a6b5bf93483862c843d51bd87ad5c02890eb081719d685ac363ec36c954852d17b62a355File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -29,6 +29,9 @@ | ||
| public interface ManifestFile { | ||
| int PARTITION_SUMMARIES_ELEMENT_ID = 508; | ||
| /** Format version for pre-v4 manifest files. */ | ||
| int LEGACY_FORMAT_VERSION = 0; | ||
| Types.NestedField PATH = | ||
| required(500, "manifest_path", Types.StringType.get(), "Location URI with FS scheme"); | ||
| Types.NestedField LENGTH = | ||
| @@ -186,6 +189,22 @@ default boolean hasDeletedFiles() { | ||
| /** Returns the total number of rows in all files with status DELETED in the manifest file. */ | ||
| Long deletedRowsCount(); | ||
| /** | ||
stevenzwu marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| * Returns the number of files with status REPLACED in the manifest file, or null for pre-v4 | ||
| * manifests. | ||
| */ | ||
| default Integer replacedFilesCount() { | ||
| return null; | ||
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. Isn't the pre-v4 value 0 because that status did not exist? That seems like the best thing to return to me. Should this also be required since it is always known for v4 manifests? | ||
| } | ||
| /** | ||
| * Returns the total number of rows in all files with status REPLACED in the manifest file, or | ||
| * null for pre-v4 manifests. | ||
| */ | ||
| default Long replacedRowsCount() { | ||
| return null; | ||
| } | ||
| /** | ||
| * Returns a list of {@link PartitionFieldSummary partition field summaries}. | ||
| * | ||
| @@ -210,6 +229,16 @@ default Long firstRowId() { | ||
| return null; | ||
| } | ||
| /** Returns the number of entries in the manifest file, or null for pre-v4 manifests. */ | ||
| default Long recordCount() { | ||
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. Why is this needed? We should have all of the more specific counts. | ||
| return null; | ||
| } | ||
| /** Returns the format version of the manifest file, or 0 for pre-v4 manifests. */ | ||
| default int formatVersion() { | ||
| return LEGACY_FORMAT_VERSION; | ||
| } | ||
| /** | ||
| * Copies this {@link ManifestFile manifest file}. Readers can reuse manifest file instances; use | ||
| * this method to make defensive copies. | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -60,6 +60,8 @@ public class GenericManifestFile extends SupportsIndexProjection | ||
| private PartitionFieldSummary[] partitions = null; | ||
| private byte[] keyMetadata = null; | ||
| private Long firstRowId = null; | ||
| private Long recordCount = null; | ||
Member 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. Looks like the ContributorAuthor 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. fixed | ||
| private int formatVersion = LEGACY_FORMAT_VERSION; | ||
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. Why update this class when these values are correctly provided by the interface? | ||
| /** Used by Avro reflection to instantiate this class when reading manifest files. */ | ||
| public GenericManifestFile(Schema avroSchema) { | ||
| @@ -94,7 +96,7 @@ public GenericManifestFile(Schema avroSchema) { | ||
| this.firstRowId = null; | ||
| } | ||
| /** Adjust the arg order to avoid conflict with the public constructor below */ | ||
| /** Pre-v4 constructor. */ | ||
| GenericManifestFile( | ||
| String path, | ||
| long length, | ||
| @@ -130,6 +132,50 @@ public GenericManifestFile(Schema avroSchema) { | ||
| this.partitions = partitions == null ? null : partitions.toArray(new PartitionFieldSummary[0]); | ||
| this.keyMetadata = ByteBuffers.toByteArray(keyMetadata); | ||
| this.firstRowId = firstRowId; | ||
| this.recordCount = null; | ||
| this.formatVersion = LEGACY_FORMAT_VERSION; | ||
| } | ||
| /** v4+ constructor variant that accepts recordCount and formatVersion. */ | ||
| GenericManifestFile( | ||
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 don't think that this should be used for v4. Manifests are now stored as | ||
| String path, | ||
| long length, | ||
| int specId, | ||
| ManifestContent content, | ||
| long sequenceNumber, | ||
| long minSequenceNumber, | ||
| Long snapshotId, | ||
| List<PartitionFieldSummary> partitions, | ||
| ByteBuffer keyMetadata, | ||
| Integer addedFilesCount, | ||
| Long addedRowsCount, | ||
| Integer existingFilesCount, | ||
| Long existingRowsCount, | ||
| Integer deletedFilesCount, | ||
| Long deletedRowsCount, | ||
| Long firstRowId, | ||
| Long recordCount, | ||
| int formatVersion) { | ||
| super(ManifestFile.schema().columns().size()); | ||
| this.avroSchema = AVRO_SCHEMA; | ||
| this.manifestPath = path; | ||
| this.length = length; | ||
| this.specId = specId; | ||
| this.content = content; | ||
| this.sequenceNumber = sequenceNumber; | ||
| this.minSequenceNumber = minSequenceNumber; | ||
| this.snapshotId = snapshotId; | ||
| this.addedFilesCount = addedFilesCount; | ||
| this.addedRowsCount = addedRowsCount; | ||
| this.existingFilesCount = existingFilesCount; | ||
| this.existingRowsCount = existingRowsCount; | ||
| this.deletedFilesCount = deletedFilesCount; | ||
| this.deletedRowsCount = deletedRowsCount; | ||
| this.partitions = partitions == null ? null : partitions.toArray(new PartitionFieldSummary[0]); | ||
| this.keyMetadata = ByteBuffers.toByteArray(keyMetadata); | ||
| this.firstRowId = firstRowId; | ||
| this.recordCount = recordCount; | ||
| this.formatVersion = formatVersion; | ||
| } | ||
| /** | ||
| @@ -172,6 +218,8 @@ private GenericManifestFile(GenericManifestFile toCopy) { | ||
| ? null | ||
| : Arrays.copyOf(toCopy.keyMetadata, toCopy.keyMetadata.length); | ||
| this.firstRowId = toCopy.firstRowId; | ||
| this.recordCount = toCopy.recordCount; | ||
| this.formatVersion = toCopy.formatVersion; | ||
| } | ||
| /** Constructor for Java serialization. */ | ||
| @@ -272,6 +320,16 @@ public Long firstRowId() { | ||
| return firstRowId; | ||
| } | ||
| @Override | ||
| public Long recordCount() { | ||
| return recordCount; | ||
| } | ||
| @Override | ||
| public int formatVersion() { | ||
| return formatVersion; | ||
| } | ||
| @Override | ||
| public int size() { | ||
| return ManifestFile.schema().columns().size(); | ||
| @@ -468,7 +526,9 @@ private CopyBuilder(ManifestFile toCopy) { | ||
| toCopy.existingRowsCount(), | ||
| toCopy.deletedFilesCount(), | ||
| toCopy.deletedRowsCount(), | ||
| toCopy.firstRowId()); | ||
| toCopy.firstRowId(), | ||
| toCopy.recordCount(), | ||
| toCopy.formatVersion()); | ||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.
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.
Does this need to be public? Another location would probably be better to avoid polluting the public API.