Class FileSchema.StructBuilder
java.lang.Object
dev.hardwood.schema.FileSchema.StructBuilder
- Enclosing class:
FileSchema
Declares the fields of a
struct group. Nested structs compose by calling
struct(String, RepetitionType, Consumer) again inside the filler.-
Method Summary
Modifier and TypeMethodDescriptionaddColumn(String columnName, PhysicalType type, RepetitionType repetition) Append a primitive field.addColumn(String columnName, PhysicalType type, RepetitionType repetition, int typeLength) Append a primitive field, giving the fixed byte length of aFIXED_LEN_BYTE_ARRAYcolumn.addColumn(String columnName, PhysicalType type, RepetitionType repetition, int typeLength, LogicalType logicalType) Append a primitive field carrying a logical type annotation, giving the fixed byte length of aFIXED_LEN_BYTE_ARRAYcolumn.addColumn(String columnName, PhysicalType type, RepetitionType repetition, LogicalType logicalType) Append a primitive field carrying a logical type annotation.list(String listName, RepetitionType repetition, Consumer<FileSchema.ElementBuilder> element) Append a nestedLISTfield.map(String mapName, RepetitionType repetition, PhysicalType keyType, int keyTypeLength, LogicalType keyLogicalType, Consumer<FileSchema.ElementBuilder> value) Append a nestedMAPfield whose key carries a logical type annotation, giving the fixed byte length of aFIXED_LEN_BYTE_ARRAYkey.map(String mapName, RepetitionType repetition, PhysicalType keyType, LogicalType keyLogicalType, Consumer<FileSchema.ElementBuilder> value) Append a nestedMAPfield whose key carries a logical type annotation.map(String mapName, RepetitionType repetition, PhysicalType keyType, Consumer<FileSchema.ElementBuilder> value) Append a nestedMAPfield.struct(String structName, RepetitionType repetition, Consumer<FileSchema.StructBuilder> filler) Append a nestedstructfield.
-
Method Details
-
addColumn
public FileSchema.StructBuilder addColumn(String columnName, PhysicalType type, RepetitionType repetition) Append a primitive field.- Throws:
IllegalArgumentException- ifrepetitionisREPEATED, or the type isFIXED_LEN_BYTE_ARRAY(use the type-length overload)
-
addColumn
public FileSchema.StructBuilder addColumn(String columnName, PhysicalType type, RepetitionType repetition, int typeLength) Append a primitive field, giving the fixed byte length of aFIXED_LEN_BYTE_ARRAYcolumn.- Throws:
IllegalArgumentException- ifrepetitionisREPEATED, ortypeLengthdoes not match the type (required and positive forFIXED_LEN_BYTE_ARRAY, absent otherwise)
-
addColumn
public FileSchema.StructBuilder addColumn(String columnName, PhysicalType type, RepetitionType repetition, LogicalType logicalType) Append a primitive field carrying a logical type annotation.- Throws:
IllegalArgumentException- ifrepetitionisREPEATED, or the annotation does not apply to the physical type
-
addColumn
public FileSchema.StructBuilder addColumn(String columnName, PhysicalType type, RepetitionType repetition, int typeLength, LogicalType logicalType) Append a primitive field carrying a logical type annotation, giving the fixed byte length of aFIXED_LEN_BYTE_ARRAYcolumn.- Throws:
IllegalArgumentException- ifrepetitionisREPEATED,typeLengthdoes not match the type, or the annotation does not apply to the physical type
-
struct
public FileSchema.StructBuilder struct(String structName, RepetitionType repetition, Consumer<FileSchema.StructBuilder> filler) Append a nestedstructfield.- Throws:
IllegalArgumentException- ifrepetitionisREPEATEDor the group has no fields
-
list
public FileSchema.StructBuilder list(String listName, RepetitionType repetition, Consumer<FileSchema.ElementBuilder> element) Append a nestedLISTfield.- Throws:
IllegalArgumentException- ifrepetitionisREPEATEDor no element is declared
-
map
public FileSchema.StructBuilder map(String mapName, RepetitionType repetition, PhysicalType keyType, Consumer<FileSchema.ElementBuilder> value) Append a nestedMAPfield.- Throws:
IllegalArgumentException- ifrepetitionisREPEATEDor no value is declared
-
map
public FileSchema.StructBuilder map(String mapName, RepetitionType repetition, PhysicalType keyType, LogicalType keyLogicalType, Consumer<FileSchema.ElementBuilder> value) Append a nestedMAPfield whose key carries a logical type annotation.- Throws:
IllegalArgumentException- ifrepetitionisREPEATED, no value is declared, or the annotation does not apply to the key's physical type
-
map
public FileSchema.StructBuilder map(String mapName, RepetitionType repetition, PhysicalType keyType, int keyTypeLength, LogicalType keyLogicalType, Consumer<FileSchema.ElementBuilder> value) Append a nestedMAPfield whose key carries a logical type annotation, giving the fixed byte length of aFIXED_LEN_BYTE_ARRAYkey.- Throws:
IllegalArgumentException- ifrepetitionisREPEATED, no value is declared,keyTypeLengthdoes not match the key's type, or the annotation does not apply to it
-