Record Class SchemaElement
java.lang.Object
java.lang.Record
dev.hardwood.metadata.SchemaElement
- Record Components:
name- column or group nametype- physical type of this element, ornullfor group nodestypeLength- byte length of the values forPhysicalType.FIXED_LEN_BYTE_ARRAY; for any other physical type, it denotes the maximum bit length used to store a value; or,nullotherwiserepetitionType- repetition level (required, optional, or repeated)numChildren- number of child elements for group nodes, ornullfor primitive nodesconvertedType- legacy converted type annotation, ornullif absentscale- decimal scale (number of digits after the decimal point), ornullif not a decimalprecision- decimal precision (total number of digits), ornullif not a decimalfieldId- Thrift field id from the schema, ornullif absentlogicalType- logical type annotation, ornullif absent
public record SchemaElement(String name, PhysicalType type, Integer typeLength, RepetitionType repetitionType, Integer numChildren, ConvertedType convertedType, Integer scale, Integer precision, Integer fieldId, LogicalType logicalType)
extends Record
Schema element in Parquet file metadata.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionSchemaElement(String name, PhysicalType type, Integer typeLength, RepetitionType repetitionType, Integer numChildren, ConvertedType convertedType, Integer scale, Integer precision, Integer fieldId, LogicalType logicalType) Creates an instance of aSchemaElementrecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theconvertedTyperecord component.final booleanIndicates whether some other object is "equal to" this one.fieldId()Returns the value of thefieldIdrecord component.static SchemaElementfixedLengthPrimitive(String name, int typeLength, RepetitionType repetitionType) Creates aPhysicalType.FIXED_LEN_BYTE_ARRAYelement.static SchemaElementfixedLengthPrimitive(String name, int typeLength, RepetitionType repetitionType, LogicalType logicalType) Creates aPhysicalType.FIXED_LEN_BYTE_ARRAYelement.static SchemaElementgroup(String name, RepetitionType repetitionType, int numChildren) Creates a group element.static SchemaElementgroup(String name, RepetitionType repetitionType, int numChildren, LogicalType logicalType) Creates a group element.final inthashCode()Returns a hash code value for this object.booleanisGroup()Returnstrueif this element is a group node (has no physical type).booleanReturnstrueif this element is a primitive node (has a physical type).Returns the value of thelogicalTyperecord component.name()Returns the value of thenamerecord component.Returns the value of thenumChildrenrecord component.Returns the value of theprecisionrecord component.static SchemaElementprimitive(String name, PhysicalType type, RepetitionType repetitionType) Creates a primitive elementstatic SchemaElementprimitive(String name, PhysicalType type, RepetitionType repetitionType, LogicalType logicalType) Creates a primitive element.Returns the value of therepetitionTyperecord component.static SchemaElementCreates a root group element, which carries no repetition.scale()Returns the value of thescalerecord component.final StringtoString()Returns a string representation of this record class.type()Returns the value of thetyperecord component.Returns the value of thetypeLengthrecord component.
-
Constructor Details
-
SchemaElement
public SchemaElement(String name, PhysicalType type, Integer typeLength, RepetitionType repetitionType, Integer numChildren, ConvertedType convertedType, Integer scale, Integer precision, Integer fieldId, LogicalType logicalType) Creates an instance of aSchemaElementrecord class.- Parameters:
name- the value for thenamerecord componenttype- the value for thetyperecord componenttypeLength- the value for thetypeLengthrecord componentrepetitionType- the value for therepetitionTyperecord componentnumChildren- the value for thenumChildrenrecord componentconvertedType- the value for theconvertedTyperecord componentscale- the value for thescalerecord componentprecision- the value for theprecisionrecord componentfieldId- the value for thefieldIdrecord componentlogicalType- the value for thelogicalTyperecord component
-
-
Method Details
-
root
Creates a root group element, which carries no repetition.- Parameters:
name- group name; the root group is named"schema"by conventionnumChildren- number of child elements, zero or more- Returns:
- the group element
- Throws:
IllegalArgumentException- ifnumChildrenis negative
-
group
Creates a group element.- Parameters:
name- group namerepetitionType- repetition level; only the root element may omit it, viaroot(String, int)numChildren- number of child elements, zero or more- Returns:
- the group element
- Throws:
IllegalArgumentException- ifrepetitionTypeisnullornumChildrenis negative
-
group
public static SchemaElement group(String name, RepetitionType repetitionType, int numChildren, LogicalType logicalType) Creates a group element.- Parameters:
name- group namerepetitionType- repetition level; only the root element may omit it, viaroot(String, int)numChildren- number of child elements, zero or morelogicalType- logical type annotation, ornullfor none- Returns:
- the group element
- Throws:
IllegalArgumentException- ifrepetitionTypeisnullornumChildrenis negative
-
primitive
public static SchemaElement primitive(String name, PhysicalType type, RepetitionType repetitionType) Creates a primitive element- Parameters:
name- column nametype- physical typerepetitionType- repetition level- Returns:
- the primitive element
- Throws:
IllegalArgumentException- ifrepetitionTypeisnull, ortypeisnullor isPhysicalType.FIXED_LEN_BYTE_ARRAY, which needs a width
-
primitive
public static SchemaElement primitive(String name, PhysicalType type, RepetitionType repetitionType, LogicalType logicalType) Creates a primitive element.- Parameters:
name- column nametype- physical typerepetitionType- repetition levellogicalType- nullable logical type annotation- Returns:
- the primitive element
- Throws:
IllegalArgumentException- ifrepetitionTypeisnull, ortypeisnullor isPhysicalType.FIXED_LEN_BYTE_ARRAY, which needs a width
-
fixedLengthPrimitive
public static SchemaElement fixedLengthPrimitive(String name, int typeLength, RepetitionType repetitionType) Creates aPhysicalType.FIXED_LEN_BYTE_ARRAYelement.- Parameters:
name- column nametypeLength- fixed byte length: must be positiverepetitionType- repetition level- Returns:
- the fixed-length primitive element
- Throws:
IllegalArgumentException- ifrepetitionTypeisnullortypeLengthis not positive
-
fixedLengthPrimitive
public static SchemaElement fixedLengthPrimitive(String name, int typeLength, RepetitionType repetitionType, LogicalType logicalType) Creates aPhysicalType.FIXED_LEN_BYTE_ARRAYelement.- Parameters:
name- column nametypeLength- fixed byte length: must be positiverepetitionType- repetition levellogicalType- nullable logical type annotation- Returns:
- the fixed-length primitive element
- Throws:
IllegalArgumentException- ifrepetitionTypeisnullortypeLengthis not positive
-
isGroup
public boolean isGroup()Returnstrueif this element is a group node (has no physical type). -
isPrimitive
public boolean isPrimitive()Returnstrueif this element is a primitive node (has a physical type). -
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
name
-
type
-
typeLength
Returns the value of thetypeLengthrecord component.- Returns:
- the value of the
typeLengthrecord component
-
repetitionType
Returns the value of therepetitionTyperecord component.- Returns:
- the value of the
repetitionTyperecord component
-
numChildren
Returns the value of thenumChildrenrecord component.- Returns:
- the value of the
numChildrenrecord component
-
convertedType
Returns the value of theconvertedTyperecord component.- Returns:
- the value of the
convertedTyperecord component
-
scale
-
precision
-
fieldId
-
logicalType
Returns the value of thelogicalTyperecord component.- Returns:
- the value of the
logicalTyperecord component
-