Package org.apache.parquet.schema
Class PrimitiveType
- java.lang.Object
-
- org.apache.parquet.schema.Type
-
- org.apache.parquet.schema.PrimitiveType
-
public final class PrimitiveType extends Type
Representation of a Primitive type
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classPrimitiveType.PrimitiveTypeNameSupported Primitive typesstatic interfacePrimitiveType.PrimitiveTypeNameConverter<T,E extends Exception>-
Nested classes/interfaces inherited from class org.apache.parquet.schema.Type
Type.ID, Type.Repetition
-
-
Constructor Summary
Constructors Constructor Description PrimitiveType(Type.Repetition repetition, PrimitiveType.PrimitiveTypeName primitive, int length, String name)PrimitiveType(Type.Repetition repetition, PrimitiveType.PrimitiveTypeName primitive, int length, String name, OriginalType originalType)Deprecated.PrimitiveType(Type.Repetition repetition, PrimitiveType.PrimitiveTypeName primitive, int length, String name, OriginalType originalType, DecimalMetadata decimalMeta, Type.ID id)Deprecated.will be removed in 2.0.0; use builders inTypesinsteadPrimitiveType(Type.Repetition repetition, PrimitiveType.PrimitiveTypeName primitive, String name)PrimitiveType(Type.Repetition repetition, PrimitiveType.PrimitiveTypeName primitive, String name, OriginalType originalType)Deprecated.will be removed in 2.0.0; use builders inTypesinstead
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidaccept(TypeVisitor visitor)Visits this type with the given visitorColumnOrdercolumnOrder()<T> PrimitiveComparator<T>comparator()Returns theTypespecific comparator for properly comparing values.protected booleancontainsPath(String[] path, int depth)<T> Tconvert(List<GroupType> path, TypeConverter<T> converter)protected booleanequals(Type other)DecimalMetadatagetDecimalMetadata()Deprecated.intgetMaxDefinitionLevel(String[] path, int i)intgetMaxRepetitionLevel(String[] path, int i)protected List<String[]>getPaths(int depth)PrimitiveType.PrimitiveTypeNamegetPrimitiveTypeName()TypegetType(String[] path, int i)intgetTypeLength()inthashCode()booleanisPrimitive()PrimitiveStringifierstringifier()protected booleantypeEquals(Type other)Deprecated.protected inttypeHashCode()Deprecated.protected Typeunion(Type toMerge)protected Typeunion(Type toMerge, boolean strict)PrimitiveTypewithId(int id)voidwriteToStringBuilder(StringBuilder sb, String indent)Writes a string representation to the provided StringBuilder-
Methods inherited from class org.apache.parquet.schema.Type
asGroupType, asPrimitiveType, eqOrBothNull, equals, getId, getLogicalTypeAnnotation, getName, getOriginalType, getRepetition, isRepetition, toString
-
-
-
-
Constructor Detail
-
PrimitiveType
public PrimitiveType(Type.Repetition repetition, PrimitiveType.PrimitiveTypeName primitive, String name)
- Parameters:
repetition- OPTIONAL, REPEATED, REQUIREDprimitive- STRING, INT64, ...name- the name of the type
-
PrimitiveType
public PrimitiveType(Type.Repetition repetition, PrimitiveType.PrimitiveTypeName primitive, int length, String name)
- Parameters:
repetition- OPTIONAL, REPEATED, REQUIREDprimitive- STRING, INT64, ...length- the length if the type is FIXED_LEN_BYTE_ARRAY, 0 otherwise (XXX)name- the name of the type
-
PrimitiveType
@Deprecated public PrimitiveType(Type.Repetition repetition, PrimitiveType.PrimitiveTypeName primitive, String name, OriginalType originalType)
Deprecated.will be removed in 2.0.0; use builders inTypesinstead- Parameters:
repetition- OPTIONAL, REPEATED, REQUIREDprimitive- STRING, INT64, ...name- the name of the typeoriginalType- (optional) the original type to help with cross schema convertion (LIST, MAP, ...)
-
PrimitiveType
@Deprecated public PrimitiveType(Type.Repetition repetition, PrimitiveType.PrimitiveTypeName primitive, int length, String name, OriginalType originalType)
Deprecated.- Parameters:
repetition- OPTIONAL, REPEATED, REQUIREDprimitive- STRING, INT64, ...name- the name of the typelength- the length if the type is FIXED_LEN_BYTE_ARRAY, 0 otherwise (XXX)originalType- (optional) the original type to help with cross schema conversion (LIST, MAP, ...)
-
PrimitiveType
@Deprecated public PrimitiveType(Type.Repetition repetition, PrimitiveType.PrimitiveTypeName primitive, int length, String name, OriginalType originalType, DecimalMetadata decimalMeta, Type.ID id)
Deprecated.will be removed in 2.0.0; use builders inTypesinstead- Parameters:
repetition- OPTIONAL, REPEATED, REQUIREDprimitive- STRING, INT64, ...name- the name of the typelength- the length if the type is FIXED_LEN_BYTE_ARRAY, 0 otherwiseoriginalType- (optional) the original type (MAP, DECIMAL, UTF8, ...)decimalMeta- (optional) metadata about the decimal typeid- the id of the field
-
-
Method Detail
-
withId
public PrimitiveType withId(int id)
-
getPrimitiveTypeName
public PrimitiveType.PrimitiveTypeName getPrimitiveTypeName()
- Returns:
- the primitive type
-
getTypeLength
public int getTypeLength()
- Returns:
- the type length
-
getDecimalMetadata
@Deprecated public DecimalMetadata getDecimalMetadata()
Deprecated.- Returns:
- the decimal type metadata
-
isPrimitive
public boolean isPrimitive()
- Specified by:
isPrimitivein classType- Returns:
- true
-
accept
public void accept(TypeVisitor visitor)
Visits this type with the given visitor
-
writeToStringBuilder
public void writeToStringBuilder(StringBuilder sb, String indent)
Writes a string representation to the provided StringBuilder- Specified by:
writeToStringBuilderin classType- Parameters:
sb- the StringBuilder to write itself toindent- indentation level
-
typeHashCode
@Deprecated protected int typeHashCode()
Deprecated.- Specified by:
typeHashCodein classType
-
typeEquals
@Deprecated protected boolean typeEquals(Type other)
Deprecated.- Specified by:
typeEqualsin classType
-
getMaxRepetitionLevel
public int getMaxRepetitionLevel(String[] path, int i)
- Specified by:
getMaxRepetitionLevelin classType
-
getMaxDefinitionLevel
public int getMaxDefinitionLevel(String[] path, int i)
- Specified by:
getMaxDefinitionLevelin classType
-
convert
public <T> T convert(List<GroupType> path, TypeConverter<T> converter)
-
containsPath
protected boolean containsPath(String[] path, int depth)
- Specified by:
containsPathin classType
-
comparator
public <T> PrimitiveComparator<T> comparator()
Returns theTypespecific comparator for properly comparing values. The natural ordering of the values might not proper in certain cases (e.g.UINT_32requires unsigned comparison ofintvalues while the natural ordering is signed.)- Type Parameters:
T- the type of values compared by the returned PrimitiveComparator- Returns:
- a PrimitiveComparator for values of this type
-
columnOrder
public ColumnOrder columnOrder()
- Returns:
- the column order for this type
-
stringifier
public PrimitiveStringifier stringifier()
- Returns:
- the
Typespecific stringifier for generating the proper string representation of the values.
-
-