Interface ArrayFactory


public interface ArrayFactory
  • Field Details

    • LOG

      static final org.apache.commons.logging.Log LOG
    • bitSetSwitchPoint

      static final int bitSetSwitchPoint
      See Also:
  • Method Details

    • create

      static StringArray create(String[] col)
    • createHash64I

      static HashLongArray createHash64I(long[] col)
    • createHash64

      static HashLongArray createHash64(String[] col)
    • createHash32I

      static HashIntegerArray createHash32I(int[] col)
    • createHash32

      static HashIntegerArray createHash32(String[] col)
    • createHash64Opt

      static OptionalArray<Object> createHash64Opt(String[] col)
    • createHash64OptI

      static OptionalArray<Object> createHash64OptI(long[] col)
    • createHash32Opt

      static OptionalArray<Object> createHash32Opt(String[] col)
    • createHash32OptI

      static OptionalArray<Object> createHash32OptI(int[] col)
    • createHash64

      static HashLongArray createHash64(long[] col)
    • createHash32

      static HashIntegerArray createHash32(int[] col)
    • create

      static BooleanArray create(boolean[] col)
    • create

      static BitSetArray create(BitSet col, int size)
    • create

      static IntegerArray create(int[] col)
    • create

      static LongArray create(long[] col)
    • create

      static FloatArray create(float[] col)
    • create

      static DoubleArray create(double[] col)
    • create

      static CharArray create(char[] col)
    • create

      static <T> Array<T> create(T[] col)
    • create

      static <T> RaggedArray<T> create(T[] col, int m)
    • create

      static Array<?> create(Types.ValueType vt, Object col)
      Wrap a fully populated raw typed column array into an Array of the given value type. The runtime type of col must match the primitive backing type of vt (e.g. double[] for Types.ValueType.FP64, String[] for Types.ValueType.STRING).

      For Types.ValueType.BOOLEAN this mirrors allocateBoolean(int): a boolean[] longer than bitSetSwitchPoint is bit-packed into a compact BitSetArray (so a bulk decoder that fills a plain boolean[] still ends up with the same representation as every other frame allocation path), while shorter columns stay a plain BooleanArray.

      Parameters:
      vt - the value type of the column
      col - the backing array to wrap
      Returns:
      an Array view over col (boolean columns may be bit-packed rather than wrapped in place)
    • allocateBacking

      static Object allocateBacking(Types.ValueType vt, int nRow)
      Allocate the raw backing array for a column of the given value type: the inverse of create(ValueType, Object). Returns double[] for Types.ValueType.FP64, int[] for INT32/UINT/HASH32, long[] for INT64/HASH64, String[] for STRING, etc. The runtime array type matches what create(ValueType, Object) expects, so a bulk decoder can fill this primitive array directly and then wrap it via create(vt, backing).
      Parameters:
      vt - the value type of the column
      nRow - the number of rows to allocate
      Returns:
      a freshly allocated raw backing array of the matching primitive/object type
    • getInMemorySize

      static long getInMemorySize(Types.ValueType type, int _numRows, boolean containsNull)
    • allocate

      static Array<?> allocate(Types.ValueType v, int nRow, String val)
    • allocate

      static Array<?> allocate(Types.ValueType v, int nRow, boolean optional)
    • allocateOptional

      static Array<?> allocateOptional(Types.ValueType v, int nRow)
    • allocateBoolean

      static ABooleanArray allocateBoolean(int nRow)
    • allocate

      static Array<?> allocate(Types.ValueType v, int nRow)
    • read

      static Array<?> read(DataInput in, int nRow) throws IOException
      Throws:
      IOException
    • append

      static <C> Array<C> append(Array<?> a, Array<?> b)
      append arrays to each other, and cast to highest common type if different types.
      Type Parameters:
      C - The type to return, java automatically make this Object, and this is fine.
      Parameters:
      a - The first array to append to (potentially modifying this a if applicable)
      b - The array to append to a, (not getting modified).
      Returns:
      A array containing the concatenation of the two.
    • set

      static <C> Array<C> set(Array<?> target, Array<?> src, int rl, int ru, int rlen)
      Set the target array in the range of rl to ru with the src array. The type returned is the common or highest common type of array. The source array is assumed to be at least of ru size.
      Type Parameters:
      C - The highest common type to return.
      Parameters:
      target - The target to put the values into
      src - The source to take the values from
      rl - The index to start on
      ru - The index to end on (inclusive)
      rlen - The length of the target (a parameter in case target is null)
      Returns:
      A new or modified array.
    • parseString

      static Object parseString(String s, Types.ValueType v)
    • defaultNullValue

      static Object defaultNullValue(Types.ValueType v)