Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions api/src/main/java/org/apache/iceberg/ContentInfo.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/*
* 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;

/**
* Metadata about externally stored content such as deletion vectors.
*
* <p>The deletion vector content is stored at the specified offset and size within the file
* referenced by {@link TrackedFile#location()}.
*
* <p>This struct must be defined when content_type is POSITION_DELETES, and must be null otherwise.
*
* <p>Note: For manifest-level deletion vectors (marking entries in a manifest as deleted), see
* {@link TrackedFile#manifestDV()} which stores the DV inline as a binary field.
*/
public interface ContentInfo {
Types.NestedField OFFSET =
Types.NestedField.required(
144, "offset", Types.LongType.get(), "Offset in the file where the content starts");
Types.NestedField SIZE_IN_BYTES =
Types.NestedField.required(
145,
"size_in_bytes",
Types.LongType.get(),
"Length of the referenced content stored in the file");

static Types.StructType schema() {
return Types.StructType.of(OFFSET, SIZE_IN_BYTES);
}

/**
* Returns the offset in the file where the deletion vector content starts.
*
* <p>The file location is specified in the {@link TrackedFile#location()} field.
*/
long offset();

/** Returns the size in bytes of the deletion vector content. */
long sizeInBytes();
}
14 changes: 12 additions & 2 deletions api/src/main/java/org/apache/iceberg/FileContent.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,21 @@
*/
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, or DELETE_MANIFEST.
*/
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);

private final int id;

Expand Down
86 changes: 86 additions & 0 deletions api/src/main/java/org/apache/iceberg/ManifestStats.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
/*
* 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");

static Types.StructType schema() {
return Types.StructType.of(
ADDED_FILES_COUNT,
EXISTING_FILES_COUNT,
DELETED_FILES_COUNT,
ADDED_ROWS_COUNT,
EXISTING_ROWS_COUNT,
DELETED_ROWS_COUNT,
MIN_SEQUENCE_NUMBER);
}

/** 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();
}
Loading