Class Types.Builder<THIS extends Types.Builder,P>

java.lang.Object
org.apache.parquet.schema.Types.Builder<THIS,P>
Type Parameters:
P - The type that this builder will return from named(String) when the type is built.
Direct Known Subclasses:
Types.BaseGroupBuilder, Types.BaseListBuilder, Types.BaseMapBuilder, Types.BasePrimitiveBuilder
Enclosing class:
Types

public abstract static class Types.Builder<THIS extends Types.Builder,P> extends Object
A base builder for Type objects.
  • Field Details

    • parent

      protected final P parent
    • returnClass

      protected final Class<? extends P> returnClass
    • repetition

      protected Type.Repetition repetition
    • logicalTypeAnnotation

      protected LogicalTypeAnnotation logicalTypeAnnotation
    • id

      protected Type.ID id
    • newLogicalTypeSet

      protected boolean newLogicalTypeSet
  • Constructor Details

    • Builder

      protected Builder(P parent)
      Construct a type builder that returns a "parent" object when the builder is finished. The parent will be returned by named(String) so that builders can be chained.
      Parameters:
      parent - a non-null object to return from named(String)
    • Builder

      protected Builder(Class<P> returnClass)
      Construct a type builder that returns the Type that was built when the builder is finished. The returnClass must be the expected Type class.
      Parameters:
      returnClass - a Type to return from named(String)
  • Method Details

    • self

      protected abstract THIS self()
    • repetition

      protected final THIS repetition(Type.Repetition repetition)
    • as

      @Deprecated public THIS as(OriginalType type)
      Deprecated.
      use as(LogicalTypeAnnotation) with the corresponding logical type instead
      Adds a type annotation (OriginalType) to the type being built.

      Type annotations are used to extend the types that parquet can store, by specifying how the primitive types should be interpreted. This keeps the set of primitive types to a minimum and reuses parquet's efficient encodings. For example, strings are stored as byte arrays (binary) with a UTF8 annotation.

      Parameters:
      type - an OriginalType
      Returns:
      this builder for method chaining
    • as

      public THIS as(LogicalTypeAnnotation type)
      Adds a type annotation (LogicalTypeAnnotation) to the type being built.

      Type annotations are used to extend the types that parquet can store, by specifying how the primitive types should be interpreted. This keeps the set of primitive types to a minimum and reuses parquet's efficient encodings. For example, strings are stored as byte arrays (binary) with a UTF8 annotation.

      Parameters:
      type - an {@link LogicalTypeAnnotation}
      Returns:
      this builder for method chaining
    • id

      public THIS id(int id)
      adds an id annotation to the type being built.

      ids are used to capture the original id when converting from models using ids (thrift, protobufs)

      Parameters:
      id - the id of the field
      Returns:
      this builder for method chaining
    • build

      protected abstract Type build(String name)
    • named

      public P named(String name)
      Builds a Type and returns the parent builder, if given, or the Type that was built. If returning a parent object that is a GroupBuilder, the constructed type will be added to it as a field.

      Note: Any configuration for this type builder should be done before calling this method.

      Parameters:
      name - a name for the constructed type
      Returns:
      the parent GroupBuilder or the constructed Type
    • getOriginalType

      protected OriginalType getOriginalType()