Class IntervalMonthDayNanoVector

All Implemented Interfaces:
Closeable, AutoCloseable, Iterable<ValueVector>, ElementAddressableVector, FieldVector, FixedWidthVector, ValueIterableVector<PeriodDuration>, ValueVector, VectorDefinitionSetter

public final class IntervalMonthDayNanoVector extends BaseFixedWidthVector implements ValueIterableVector<PeriodDuration>
IntervalMonthDayNanoVector implements a fixed width vector (16 bytes) of interval (month, days and nanoseconds) values which could be null. A validity buffer (bit vector) is maintained to track which elements in the vector are null.

Month, day and nanoseconds are independent from one another and there is no specific limits imposed on their values.

  • Field Details

  • Constructor Details

    • IntervalMonthDayNanoVector

      public IntervalMonthDayNanoVector(String name, BufferAllocator allocator)
      Instantiate a IntervalMonthDayNanoVector. This doesn't allocate any memory for the data in vector.
      Parameters:
      name - name of the vector
      allocator - allocator for memory management.
    • IntervalMonthDayNanoVector

      public IntervalMonthDayNanoVector(String name, FieldType fieldType, BufferAllocator allocator)
      Instantiate a IntervalMonthDayNanoVector. This doesn't allocate any memory for the data in vector.
      Parameters:
      name - name of the vector
      fieldType - type of Field materialized by this vector
      allocator - allocator for memory management.
    • IntervalMonthDayNanoVector

      public IntervalMonthDayNanoVector(Field field, BufferAllocator allocator)
      Instantiate a IntervalMonthDayNanoVector. This doesn't allocate any memory for the data in vector.
      Parameters:
      field - field materialized by this vector
      allocator - allocator for memory management.
  • Method Details

    • getReaderImpl

      protected FieldReader getReaderImpl()
      Description copied from class: BaseValueVector
      Each vector has a different reader that implements the FieldReader interface. Overridden methods must make sure to return the correct concrete reader implementation.
      Specified by:
      getReaderImpl in class BaseValueVector
      Returns:
      Returns a lambda that initializes a reader when called.
    • getMinorType

      public Types.MinorType getMinorType()
      Get minor type for this vector. The vector holds values belonging to a particular type.
      Specified by:
      getMinorType in interface ValueVector
      Returns:
      Types.MinorType
    • getMonths

      public static int getMonths(ArrowBuf buffer, int index)
      Given a data buffer, get the number of months stored at a particular position in the vector.

      This method should not be used externally.

      Parameters:
      buffer - data buffer
      index - position of the element.
      Returns:
      day value stored at the index.
    • getDays

      public static int getDays(ArrowBuf buffer, int index)
      Given a data buffer, get the number of days stored at a particular position in the vector.

      This method should not be used externally.

      Parameters:
      buffer - data buffer
      index - position of the element.
      Returns:
      day value stored at the index.
    • getNanoseconds

      public static long getNanoseconds(ArrowBuf buffer, int index)
      Given a data buffer, get the get the number of nanoseconds stored at a particular position in the vector.

      This method should not be used externally.

      Parameters:
      buffer - data buffer
      index - position of the element.
      Returns:
      nanoseconds value stored at the index.
    • get

      public ArrowBuf get(int index) throws IllegalStateException
      Get the element at the given index from the vector.
      Parameters:
      index - position of element
      Returns:
      element at given index
      Throws:
      IllegalStateException
    • get

      public void get(int index, NullableIntervalMonthDayNanoHolder holder)
      Get the element at the given index from the vector and sets the state in holder. If element at given index is null, holder.isSet will be zero.
      Parameters:
      index - position of element
    • getObject

      public PeriodDuration getObject(int index)
      Same as get(int).
      Specified by:
      getObject in interface ValueVector
      Parameters:
      index - position of element
      Returns:
      element at given index
    • getAsStringBuilder

      public StringBuilder getAsStringBuilder(int index)
      Get the Interval value at a given index as a StringBuilder object.
      Parameters:
      index - position of the element
      Returns:
      String Builder object with Interval value as
    • set

      public void set(int index, ArrowBuf value)
      Set the element at the given index to the given value.
      Parameters:
      index - position of element
      value - value of element
    • set

      public void set(int index, int months, int days, long nanoseconds)
      Set the element at the given index to the given value.
      Parameters:
      index - position of element
      months - months component of interval
      days - days component of interval
      nanoseconds - nanosecond component of interval
    • set

      public void set(int index, NullableIntervalMonthDayNanoHolder holder) throws IllegalArgumentException
      Set the element at the given index to the value set in data holder. If the value in holder is not indicated as set, element at the given index will be null.
      Parameters:
      index - position of element
      holder - nullable data holder for value of element
      Throws:
      IllegalArgumentException
    • set

      public void set(int index, IntervalMonthDayNanoHolder holder)
      Set the element at the given index to the value set in data holder.
      Parameters:
      index - position of element
      holder - data holder for value of element
    • setSafe

      public void setSafe(int index, ArrowBuf value)
      Same as set(int, ArrowBuf) except that it handles the case when index is greater than or equal to existing value capacity BaseFixedWidthVector.getValueCapacity().
      Parameters:
      index - position of element
      value - value of element
    • setSafe

      public void setSafe(int index, int months, int days, long nanoseconds)
      Same as set(int, int, int, long) except that it handles the case when index is greater than or equal to existing value capacity BaseFixedWidthVector.getValueCapacity().
      Parameters:
      index - position of element
      months - months for the interval
      days - days for the interval
      nanoseconds - nanoseconds for the interval
    • setSafe

      public void setSafe(int index, NullableIntervalMonthDayNanoHolder holder) throws IllegalArgumentException
      Same as set(int, NullableIntervalMonthDayNanoHolder) except that it handles the case when index is greater than or equal to existing value capacity BaseFixedWidthVector.getValueCapacity().
      Parameters:
      index - position of element
      holder - nullable data holder for value of element
      Throws:
      IllegalArgumentException
    • setSafe

      public void setSafe(int index, IntervalMonthDayNanoHolder holder)
      Same as set(int, IntervalMonthDayNanoHolder) except that it handles the case when index is greater than or equal to existing value capacity BaseFixedWidthVector.getValueCapacity().
      Parameters:
      index - position of element
      holder - data holder for value of element
    • set

      public void set(int index, int isSet, int months, int days, long nanoseconds)
      Store the given value at a particular position in the vector. isSet indicates whether the value is NULL or not.
      Parameters:
      index - position of the new value
      isSet - 0 for NULL value, 1 otherwise
      months - months component of interval
      days - days component of interval
      nanoseconds - nanosecond component of interval
    • setSafe

      public void setSafe(int index, int isSet, int months, int days, long nanoseconds)
      Same as set(int, int, int, int, long) except that it handles the case when index is greater than or equal to current value capacity of the vector.
      Parameters:
      index - position of the new value
      isSet - 0 for NULL value, 1 otherwise
      months - months component of interval
      days - days component of interval
      nanoseconds - nanosecond component of interval
    • getTransferPair

      public TransferPair getTransferPair(String ref, BufferAllocator allocator)
      Construct a TransferPair comprising this and a target vector of the same type.
      Specified by:
      getTransferPair in interface ValueVector
      Specified by:
      getTransferPair in class BaseFixedWidthVector
      Parameters:
      ref - name of the target vector
      allocator - allocator for the target vector
      Returns:
      TransferPair
    • getTransferPair

      public TransferPair getTransferPair(Field field, BufferAllocator allocator)
      Construct a TransferPair comprising of this and a target vector of the same type.
      Specified by:
      getTransferPair in interface ValueVector
      Specified by:
      getTransferPair in class BaseFixedWidthVector
      Parameters:
      field - Field object used by the target vector
      allocator - allocator for the target vector
      Returns:
      TransferPair
    • makeTransferPair

      public TransferPair makeTransferPair(ValueVector to)
      Construct a TransferPair with a desired target vector of the same type.
      Specified by:
      makeTransferPair in interface ValueVector
      Parameters:
      to - target vector
      Returns:
      TransferPair