Class NonNullableStructVector

All Implemented Interfaces:
Closeable, AutoCloseable, Iterable<ValueVector>, DensityAwareVector, ValueIterableVector<Map<String,?>>, ValueVector
Direct Known Subclasses:
StructVector

public class NonNullableStructVector extends AbstractStructVector implements ValueIterableVector<Map<String,?>>
A struct vector that has no null values (and no validity buffer). Child Vectors are handled in AbstractStructVector.
  • Field Details

    • field

      protected Field field
    • valueCount

      public int valueCount
  • Constructor Details

    • NonNullableStructVector

      public NonNullableStructVector(String name, BufferAllocator allocator, FieldType fieldType, CallBack callBack)
      Constructs a new instance.
      Parameters:
      name - The name of the instance.
      allocator - The allocator to use to allocating/reallocating buffers.
      fieldType - The type of this list.
    • NonNullableStructVector

      public NonNullableStructVector(Field field, BufferAllocator allocator, CallBack callBack)
      Constructs a new instance.
      Parameters:
      field - The field materialized by this vector.
      allocator - The allocator to use to allocating/reallocating buffers.
      callBack - A schema change callback.
    • NonNullableStructVector

      public NonNullableStructVector(String name, BufferAllocator allocator, FieldType fieldType, CallBack callBack, AbstractStructVector.ConflictPolicy conflictPolicy, boolean allowConflictPolicyChanges)
      Constructs a new instance.
      Parameters:
      name - The name of the instance.
      allocator - The allocator to use to allocating/reallocating buffers.
      fieldType - The type of this list.
      callBack - A schema change callback.
      conflictPolicy - How to handle duplicate field names in the struct.
    • NonNullableStructVector

      public NonNullableStructVector(Field field, BufferAllocator allocator, CallBack callBack, AbstractStructVector.ConflictPolicy conflictPolicy, boolean allowConflictPolicyChanges)
      Constructs a new instance.
      Parameters:
      field - The field materialized by this vector.
      allocator - The allocator to use to allocating/reallocating buffers.
      callBack - A schema change callback.
      conflictPolicy - How to handle duplicate field names in the struct.
  • Method Details

    • empty

      public static NonNullableStructVector empty(String name, BufferAllocator allocator)
      Construct a new empty instance which replaces an existing field with the new one in case of name conflict.
    • emptyWithDuplicates

      public static NonNullableStructVector emptyWithDuplicates(String name, BufferAllocator allocator)
      Construct a new empty instance which preserve fields with identical names.
    • getReader

      public FieldReader getReader()
      Description copied from interface: ValueVector
      Get a reader for this vector.
      Specified by:
      getReader in interface ValueVector
      Returns:
      a field reader that supports reading values from this vector.
    • copyFrom

      public void copyFrom(int fromIndex, int thisIndex, ValueVector from)
      Copies the element at fromIndex in the provided vector to thisIndex. Reallocates buffers if thisIndex is larger then current capacity.
      Specified by:
      copyFrom in interface ValueVector
      Overrides:
      copyFrom in class AbstractContainerVector
      Parameters:
      fromIndex - position to copy from in source vector
      thisIndex - position to copy to in this vector
      from - source vector
    • copyFromSafe

      public void copyFromSafe(int fromIndex, int thisIndex, ValueVector from)
      Description copied from interface: ValueVector
      Same as ValueVector.copyFrom(int, int, ValueVector) except that it handles the case when the capacity of the vector needs to be expanded before copy.
      Specified by:
      copyFromSafe in interface ValueVector
      Overrides:
      copyFromSafe in class AbstractContainerVector
      Parameters:
      fromIndex - position to copy from in source vector
      thisIndex - position to copy to in this vector
      from - source vector
    • supportsDirectRead

      protected boolean supportsDirectRead()
      Overrides:
      supportsDirectRead in class AbstractContainerVector
    • fieldNameIterator

      public Iterator<String> fieldNameIterator()
    • setInitialCapacity

      public void setInitialCapacity(int numRecords)
      Description copied from interface: ValueVector
      Set the initial record capacity.
      Specified by:
      setInitialCapacity in interface ValueVector
      Parameters:
      numRecords - the initial record capacity.
    • setInitialCapacity

      public void setInitialCapacity(int valueCount, double density)
      Description copied from interface: DensityAwareVector
      Set value with density.
      Specified by:
      setInitialCapacity in interface DensityAwareVector
      Parameters:
      valueCount - the number of values in this vector
      density - the density of the vector
    • getBufferSize

      public int getBufferSize()
      Description copied from interface: ValueVector
      Get the number of bytes used by this vector.
      Specified by:
      getBufferSize in interface ValueVector
      Overrides:
      getBufferSize in class AbstractStructVector
      Returns:
      the number of bytes that is used by this vector instance.
    • getBufferSizeFor

      public int getBufferSizeFor(int valueCount)
      Description copied from interface: ValueVector
      Returns the number of bytes that is used by this vector if it holds the given number of values. The result will be the same as if setValueCount() were called, followed by calling getBufferSize(), but without any of the closing side-effects that setValueCount() implies wrt finishing off the population of a vector. Some operations might wish to use this to determine how much memory has been used by a vector so far, even though it is not finished being populated.
      Specified by:
      getBufferSizeFor in interface ValueVector
      Parameters:
      valueCount - the number of values to assume this vector contains
      Returns:
      the buffer size if this vector is holding valueCount values
    • getValidityBuffer

      public ArrowBuf getValidityBuffer()
      Description copied from interface: ValueVector
      Gets the underlying buffer associated with validity vector.
      Specified by:
      getValidityBuffer in interface ValueVector
      Returns:
      buffer
    • getDataBuffer

      public ArrowBuf getDataBuffer()
      Description copied from interface: ValueVector
      Gets the underlying buffer associated with data vector.
      Specified by:
      getDataBuffer in interface ValueVector
      Returns:
      buffer
    • getOffsetBuffer

      public ArrowBuf getOffsetBuffer()
      Description copied from interface: ValueVector
      Gets the underlying buffer associated with offset vector.
      Specified by:
      getOffsetBuffer in interface ValueVector
      Returns:
      buffer
    • getTransferPair

      public TransferPair getTransferPair(BufferAllocator allocator)
      Description copied from interface: ValueVector
      To transfer quota responsibility.
      Specified by:
      getTransferPair in interface ValueVector
      Parameters:
      allocator - the target allocator
      Returns:
      a transfer pair, creating a new target vector of the same type.
    • getTransferPair

      public TransferPair getTransferPair(String ref, BufferAllocator allocator, CallBack callBack)
      Description copied from interface: ValueVector
      To transfer quota responsibility.
      Specified by:
      getTransferPair in interface ValueVector
      Parameters:
      ref - the name of the vector
      allocator - the target allocator
      callBack - A schema change callback.
      Returns:
      a transfer pair, creating a new target vector of the same type.
    • makeTransferPair

      public TransferPair makeTransferPair(ValueVector to)
      Description copied from interface: ValueVector
      Makes a new transfer pair used to transfer underlying buffers.
      Specified by:
      makeTransferPair in interface ValueVector
      Parameters:
      to - the target for the transfer
      Returns:
      a new transfer pair that is used to transfer underlying buffers into the target vector.
    • getTransferPair

      public TransferPair getTransferPair(String ref, BufferAllocator allocator)
      Description copied from interface: ValueVector
      To transfer quota responsibility.
      Specified by:
      getTransferPair in interface ValueVector
      Parameters:
      ref - the name of the vector
      allocator - the target allocator
      Returns:
      a transfer pair, creating a new target vector of the same type.
    • getTransferPair

      public TransferPair getTransferPair(Field field, BufferAllocator allocator)
      Description copied from interface: ValueVector
      To transfer quota responsibility.
      Specified by:
      getTransferPair in interface ValueVector
      Parameters:
      field - the Field object used by the target vector
      allocator - the target allocator
      Returns:
      a transfer pair, creating a new target vector of the same type.
    • getTransferPair

      public TransferPair getTransferPair(Field field, BufferAllocator allocator, CallBack callBack)
      Description copied from interface: ValueVector
      To transfer quota responsibility.
      Specified by:
      getTransferPair in interface ValueVector
      Parameters:
      field - the Field object used by the target vector
      allocator - the target allocator
      callBack - A schema change callback.
      Returns:
      a transfer pair, creating a new target vector of the same type.
    • getValueCapacity

      public int getValueCapacity()
      Description copied from interface: ValueVector
      Returns the maximum number of values that can be stored in this vector instance.
      Specified by:
      getValueCapacity in interface ValueVector
      Returns:
      the maximum number of values that can be stored in this vector instance.
    • getObject

      public Map<String,?> getObject(int index)
      Description copied from interface: ValueVector
      Get friendly type object from the vector.
      Specified by:
      getObject in interface ValueVector
      Parameters:
      index - index of object to get
      Returns:
      friendly type object
    • hashCode

      public int hashCode(int index)
      Description copied from interface: ValueVector
      Returns hashCode of element in index with the default hasher.
      Specified by:
      hashCode in interface ValueVector
    • hashCode

      public int hashCode(int index, ArrowBufHasher hasher)
      Description copied from interface: ValueVector
      Returns hashCode of element in index with the given hasher.
      Specified by:
      hashCode in interface ValueVector
    • accept

      public <OUT, IN> OUT accept(VectorVisitor<OUT,IN> visitor, IN value)
      Description copied from interface: ValueVector
      Accept a generic VectorVisitor and return the result.
      Specified by:
      accept in interface ValueVector
      Type Parameters:
      OUT - the output result type.
      IN - the input data together with visitor.
    • isNull

      public boolean isNull(int index)
      Description copied from interface: ValueVector
      Check whether an element in the vector is null.
      Specified by:
      isNull in interface ValueVector
      Parameters:
      index - index to check for null
      Returns:
      true if element is null
    • getNullCount

      public int getNullCount()
      Description copied from interface: ValueVector
      Returns number of null elements in the vector.
      Specified by:
      getNullCount in interface ValueVector
      Returns:
      number of null elements
    • get

      public void get(int index, ComplexHolder holder)
    • getValueCount

      public int getValueCount()
      Description copied from interface: ValueVector
      Gets the number of values.
      Specified by:
      getValueCount in interface ValueVector
      Returns:
      number of values in the vector
    • getVectorById

      public ValueVector getVectorById(int id)
    • getVectorById

      public <V extends ValueVector> V getVectorById(int id, Class<V> clazz)
      Gets a child vector by ordinal position and casts to the specified class.
    • setValueCount

      public void setValueCount(int valueCount)
      Description copied from interface: ValueVector
      Set number of values in the vector.
      Specified by:
      setValueCount in interface ValueVector
    • clear

      public void clear()
      Description copied from interface: ValueVector
      Release any owned ArrowBuf and reset the ValueVector to the initial state. If the vector has any child vectors, they will also be cleared.
      Specified by:
      clear in interface ValueVector
    • reset

      public void reset()
      Description copied from interface: ValueVector
      Reset the ValueVector to the initial state without releasing any owned ArrowBuf. Buffer capacities will remain unchanged and any previous data will be zeroed out. This includes buffers for data, validity, offset, etc. If the vector has any child vectors, they will also be reset.
      Specified by:
      reset in interface ValueVector
    • getField

      public Field getField()
      Description copied from interface: ValueVector
      Get information about how this field is materialized.
      Specified by:
      getField in interface ValueVector
      Returns:
      the field corresponding to this vector
    • getMinorType

      public Types.MinorType getMinorType()
      Specified by:
      getMinorType in interface ValueVector
    • close

      public void close()
      Description copied from class: AbstractContainerVector
      Clears out all underlying child vectors.
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Specified by:
      close in interface ValueVector
      Overrides:
      close in class AbstractStructVector
    • initializeChildrenFromFields

      public void initializeChildrenFromFields(List<Field> children)
      Initializes the struct's members from the given Fields.
    • getChildrenFromFields

      public List<FieldVector> getChildrenFromFields()