Package org.apache.iceberg.data
Class PartitionStatsHandler
java.lang.Object
org.apache.iceberg.data.PartitionStatsHandler
Computes, writes and reads the
PartitionStatisticsFile
. Uses generic readers and writers
to support writing and reading of the stats in table default format.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Types.NestedField
static final Types.NestedField
static final Types.NestedField
static final Types.NestedField
static final Types.NestedField
static final Types.NestedField
static final int
static final String
static final Types.NestedField
static final Types.NestedField
static final Types.NestedField
static final Types.NestedField
static final Types.NestedField
-
Method Summary
Modifier and TypeMethodDescriptionstatic PartitionStatisticsFile
computeAndWriteStatsFile
(Table table) Computes and writes thePartitionStatisticsFile
for a given table's current snapshot.static PartitionStatisticsFile
computeAndWriteStatsFile
(Table table, long snapshotId) Computes and writes thePartitionStatisticsFile
for a given table and snapshot.static CloseableIterable<PartitionStats>
readPartitionStatsFile
(Schema schema, InputFile inputFile) Reads partition statistics from the specifiedInputFile
using given schema.static Schema
schema
(Types.StructType unifiedPartitionType) Generates the partition stats file schema based on a combined partition type which considers all specs in a table.
-
Field Details
-
PARTITION_FIELD_ID
public static final int PARTITION_FIELD_ID- See Also:
-
PARTITION_FIELD_NAME
- See Also:
-
SPEC_ID
-
DATA_RECORD_COUNT
-
DATA_FILE_COUNT
-
TOTAL_DATA_FILE_SIZE_IN_BYTES
-
POSITION_DELETE_RECORD_COUNT
-
POSITION_DELETE_FILE_COUNT
-
EQUALITY_DELETE_RECORD_COUNT
-
EQUALITY_DELETE_FILE_COUNT
-
TOTAL_RECORD_COUNT
-
LAST_UPDATED_AT
-
LAST_UPDATED_SNAPSHOT_ID
-
-
Method Details
-
schema
Generates the partition stats file schema based on a combined partition type which considers all specs in a table.- Parameters:
unifiedPartitionType
- unified partition schema type. Could be calculated byPartitioning.partitionType(Table)
.- Returns:
- a schema that corresponds to the provided unified partition type.
-
computeAndWriteStatsFile
Computes and writes thePartitionStatisticsFile
for a given table's current snapshot.- Parameters:
table
- TheTable
for which the partition statistics is computed.- Returns:
PartitionStatisticsFile
for the current snapshot, or null if no statistics are present.- Throws:
IOException
-
computeAndWriteStatsFile
public static PartitionStatisticsFile computeAndWriteStatsFile(Table table, long snapshotId) throws IOException Computes and writes thePartitionStatisticsFile
for a given table and snapshot.- Parameters:
table
- TheTable
for which the partition statistics is computed.snapshotId
- snapshot for which partition statistics are computed.- Returns:
PartitionStatisticsFile
for the given snapshot, or null if no statistics are present.- Throws:
IOException
-
readPartitionStatsFile
public static CloseableIterable<PartitionStats> readPartitionStatsFile(Schema schema, InputFile inputFile) Reads partition statistics from the specifiedInputFile
using given schema.
-