Class FieldBuilder


  • public class FieldBuilder
    extends Object
    Convenience builder that can be used to create new Apache Arrow fields for common types more easily than alternative methods of construction, especially for complex types.
    • Method Detail

      • newBuilder

        public static FieldBuilder newBuilder​(String name,
                                              org.apache.arrow.vector.types.pojo.ArrowType type)
        Creates a FieldBuilder for a Field with the given name and type.
        Parameters:
        name - The name to use for the Field being built.
        type - The type to use for the Field being built, most often one of STRUCT or LIST.
        Returns:
        A new FieldBuilder for the specified name and type.
      • newBuilder

        public static FieldBuilder newBuilder​(String name,
                                              org.apache.arrow.vector.types.pojo.ArrowType type,
                                              boolean nullable)
        Creates a FieldBuilder for a Field with the given name, type, and whether or not the field is nullable.
        Parameters:
        name - The name to use for the Field being built.
        type - The type to use for the Field being built, most often one of STRUCT or LIST.
        nullable - A true or false value indicating that the field can contain null values. Most often used for MAP types.
        Returns:
        A new FieldBuilder for the specified name and type.
      • addField

        public FieldBuilder addField​(String fieldName,
                                     org.apache.arrow.vector.types.pojo.ArrowType type,
                                     List<org.apache.arrow.vector.types.pojo.Field> children)
        Adds a new child field with the requested attributes.
        Parameters:
        fieldName - The name of the child field.
        type - The type of the child field.
        children - The children to add to the child field (empty list if no children desired).
        Returns:
        This FieldBuilder itself.
      • addField

        public FieldBuilder addField​(String fieldName,
                                     org.apache.arrow.vector.types.pojo.ArrowType type,
                                     boolean nullable,
                                     List<org.apache.arrow.vector.types.pojo.Field> children)
      • addField

        public FieldBuilder addField​(org.apache.arrow.vector.types.pojo.Field child)
        Adds the provided field as a child to the builder.
        Parameters:
        child - The child to add to the Field being built.
        Returns:
        This FieldBuilder itself.
      • addStringField

        public FieldBuilder addStringField​(String fieldName)
        Adds a new VARCHAR child field with the given name to the builder.
        Parameters:
        fieldName - The name to use for the newly added child field.
        Returns:
        This FieldBuilder itself.
      • addListField

        public FieldBuilder addListField​(String fieldName,
                                         org.apache.arrow.vector.types.pojo.ArrowType type)
        Adds a new LIST child field with the given name to the builder.
        Parameters:
        fieldName - The name to use for the newly added child field.
        type - The concrete type for values in the List
        Returns:
        This FieldBuilder itself.
      • addIntField

        public FieldBuilder addIntField​(String fieldName)
        Adds a new INT child field with the given name to the builder.
        Parameters:
        fieldName - The name to use for the newly added child field.
        Returns:
        This FieldBuilder itself.
      • addFloat8Field

        public FieldBuilder addFloat8Field​(String fieldName)
        Adds a new FLOAT8 child field with the given name to the builder.
        Parameters:
        fieldName - The name to use for the newly added child field.
        Returns:
        This FieldBuilder itself.
      • addBigIntField

        public FieldBuilder addBigIntField​(String fieldName)
        Adds a new BIGINT child field with the given name to the builder.
        Parameters:
        fieldName - The name to use for the newly added child field.
        Returns:
        This FieldBuilder itself.
      • addBitField

        public FieldBuilder addBitField​(String fieldName)
        Adds a new BIT child field with the given name to the builder.
        Parameters:
        fieldName - The name to use for the newly added child field.
        Returns:
        This FieldBuilder itself.
      • addTinyIntField

        public FieldBuilder addTinyIntField​(String fieldName)
        Adds a new TinyInt child field with the given name to the builder.
        Parameters:
        fieldName - The name to use for the newly added child field.
        Returns:
        This FieldBuilder itself.
      • addSmallIntField

        public FieldBuilder addSmallIntField​(String fieldName)
        Adds a new SmallInt child field with the given name to the builder.
        Parameters:
        fieldName - The name to use for the newly added child field.
        Returns:
        This FieldBuilder itself.
      • addFloat4Field

        public FieldBuilder addFloat4Field​(String fieldName)
        Adds a new Float4 child field with the given name to the builder.
        Parameters:
        fieldName - The name to use for the newly added child field.
        Returns:
        This FieldBuilder itself.
      • addDecimalField

        public FieldBuilder addDecimalField​(String fieldName,
                                            int precision,
                                            int scale)
        Adds a new Decimal child field with the given name to the builder.
        Parameters:
        fieldName - The name to use for the newly added child field.
        Returns:
        This FieldBuilder itself.
      • addDateDayField

        public FieldBuilder addDateDayField​(String fieldName)
        Adds a new DateDay child field with the given name to the builder.
        Parameters:
        fieldName - The name to use for the newly added child field.
        Returns:
        This FieldBuilder itself.
      • addDateMilliField

        public FieldBuilder addDateMilliField​(String fieldName)
        Adds a new DateMilli child field with the given name to the builder.
        Parameters:
        fieldName - The name to use for the newly added child field.
        Returns:
        This FieldBuilder itself.
      • getChild

        public org.apache.arrow.vector.types.pojo.Field getChild​(String fieldName)
      • build

        public org.apache.arrow.vector.types.pojo.Field build()
        Builds the fields.
        Returns:
        The newly constructed Field.