Package org.apache.iceberg
Class PartitionSpec
- java.lang.Object
- 
- org.apache.iceberg.PartitionSpec
 
- 
- All Implemented Interfaces:
- java.io.Serializable
 
 public class PartitionSpec extends java.lang.Object implements java.io.SerializableRepresents how to produce partition data for a table.Partition data is produced by transforming columns in a table. Each column transform is represented by a named PartitionField.- See Also:
- Serialized Form
 
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description static classPartitionSpec.BuilderUsed to create validpartition specs.
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static PartitionSpec.BuilderbuilderFor(Schema schema)Creates a newpartition spec builderfor the givenSchema.booleancompatibleWith(PartitionSpec other)Returns true if this spec is equivalent to the other, with partition field ids ignored.booleanequals(java.lang.Object other)java.util.List<PartitionField>fields()Returns the list ofpartition fieldsfor this spec.java.util.List<PartitionField>getFieldsBySourceId(int fieldId)Returns thefieldthat partitions the given source fieldinthashCode()java.util.Set<java.lang.Integer>identitySourceIds()Returns the source field ids for identity partitions.booleanisPartitioned()booleanisUnpartitioned()java.lang.Class<?>[]javaClasses()java.lang.StringpartitionToPath(StructLike data)Types.StructTypepartitionType()Returns aTypes.StructTypefor partition data defined by this spec.Schemaschema()Returns theSchemafor this spec.intspecId()Returns the ID of this spec.java.lang.StringtoString()UnboundPartitionSpectoUnbound()static PartitionSpecunpartitioned()Returns a spec for unpartitioned tables.
 
- 
- 
- 
Method Detail- 
specIdpublic int specId() Returns the ID of this spec.
 - 
fieldspublic java.util.List<PartitionField> fields() Returns the list ofpartition fieldsfor this spec.
 - 
isPartitionedpublic boolean isPartitioned() 
 - 
isUnpartitionedpublic boolean isUnpartitioned() 
 - 
toUnboundpublic UnboundPartitionSpec toUnbound() 
 - 
getFieldsBySourceIdpublic java.util.List<PartitionField> getFieldsBySourceId(int fieldId) Returns thefieldthat partitions the given source field- Parameters:
- fieldId- a field id from the source schema
- Returns:
- the fieldthat partitions the given source field
 
 - 
partitionTypepublic Types.StructType partitionType() Returns aTypes.StructTypefor partition data defined by this spec.
 - 
javaClassespublic java.lang.Class<?>[] javaClasses() 
 - 
partitionToPathpublic java.lang.String partitionToPath(StructLike data) 
 - 
compatibleWithpublic boolean compatibleWith(PartitionSpec other) Returns true if this spec is equivalent to the other, with partition field ids ignored. That is, if both specs have the same number of fields, field order, field name, source columns, and transforms.- Parameters:
- other- another PartitionSpec
- Returns:
- true if the specs have the same fields, source columns, and transforms.
 
 - 
equalspublic boolean equals(java.lang.Object other) - Overrides:
- equalsin class- java.lang.Object
 
 - 
hashCodepublic int hashCode() - Overrides:
- hashCodein class- java.lang.Object
 
 - 
identitySourceIdspublic java.util.Set<java.lang.Integer> identitySourceIds() Returns the source field ids for identity partitions.- Returns:
- a set of source ids for the identity partitions.
 
 - 
toStringpublic java.lang.String toString() - Overrides:
- toStringin class- java.lang.Object
 
 - 
unpartitionedpublic static PartitionSpec unpartitioned() Returns a spec for unpartitioned tables.- Returns:
- a partition spec with no partitions
 
 - 
builderForpublic static PartitionSpec.Builder builderFor(Schema schema) Creates a newpartition spec builderfor the givenSchema.- Parameters:
- schema- a schema
- Returns:
- a partition spec builder for the given schema
 
 
- 
 
-