Class ColumnHolder

java.lang.Object
com.illumon.iris.db.v2.utils.ColumnHolder

public class ColumnHolder
extends Object
Data to construct a data column.
  • Field Details

  • Constructor Details

    • ColumnHolder

      public ColumnHolder​(String name, boolean grouped, T... arrayData)
      Construct a new set of column data.
      Type Parameters:
      T - column element type
      Parameters:
      name - column name
      grouped - true if the column is grouped; false otherwise
      arrayData - column data
    • ColumnHolder

      public ColumnHolder​(String name, Class<T> clazz, T... arrayData)
      Construct a new set of column data.
      Type Parameters:
      T - column element type
      Parameters:
      name - column name
      arrayData - column data
    • ColumnHolder

      public ColumnHolder​(String name, boolean grouped, long... arrayData)
      Construct a new set of column data.
      Parameters:
      name - column name
      grouped - true if the column is grouped; false otherwise
      arrayData - column data
    • ColumnHolder

      public ColumnHolder​(String name, boolean grouped, int... arrayData)
      Construct a new set of column data.
      Parameters:
      name - column name
      grouped - true if the column is grouped; false otherwise
      arrayData - column data
    • ColumnHolder

      public ColumnHolder​(String name, boolean grouped, short... arrayData)
      Construct a new set of column data.
      Parameters:
      name - column name
      grouped - true if the column is grouped; false otherwise
      arrayData - column data
    • ColumnHolder

      public ColumnHolder​(String name, boolean grouped, char... arrayData)
      Construct a new set of column data.
      Parameters:
      name - column name
      grouped - true if the column is grouped; false otherwise
      arrayData - column data
    • ColumnHolder

      public ColumnHolder​(String name, boolean grouped, byte... arrayData)
      Construct a new set of column data.
      Parameters:
      name - column name
      grouped - true if the column is grouped; false otherwise
      arrayData - column data
    • ColumnHolder

      public ColumnHolder​(String name, boolean grouped, double... arrayData)
      Construct a new set of column data.
      Parameters:
      name - column name
      grouped - true if the column is grouped; false otherwise
      arrayData - column data
    • ColumnHolder

      public ColumnHolder​(String name, boolean grouped, float... arrayData)
      Construct a new set of column data.
      Parameters:
      name - column name
      grouped - true if the column is grouped; false otherwise
      arrayData - column data
    • ColumnHolder

      protected ColumnHolder​(boolean chunkSentinel, String name, Class type, boolean grouped, Chunk<Attributes.Values> chunkData)
      Construct a new set of column data with a specified type using a chunk. This overload allows the creation of a ColumnHolder where the official data type type does not match the data.
      Parameters:
      name - column name
      type - abstract data type for the column
      grouped - true if the column is grouped; false otherwise
      chunkData - column data
  • Method Details

    • makeForChunk

      public static ColumnHolder makeForChunk​(String name, Class<?> type, boolean grouped, Chunk<Attributes.Values> chunkData)
    • getDateTimeColumnHolder

      public static ColumnHolder getDateTimeColumnHolder​(String name, boolean grouped, long... data)
      Create a column holder for a DateTime column where the values are represented as longs. Whatever process produces a table from this column holder should respect this and create the appropriate type of ColumnSource. Under normal conditions, this will be a DateTimeArraySource (see getColumnSource()).
      Parameters:
      name - column name
      grouped - true if the column is grouped; false otherwise
      data - column data (long integers representing nanos since the epoch)
      Returns:
      a DBDateTime column holder implemented with longs for storage
    • getDateTimeColumnHolder

      public static ColumnHolder getDateTimeColumnHolder​(String name, boolean grouped, Chunk<Attributes.Values> data)
      Create a column holder for a DateTime column where the values are represented as longs. Whatever process produces a table from this column holder should respect this and create the appropriate type of ColumnSource. Under normal conditions, this will be a DateTimeArraySource (see getColumnSource()).
      Parameters:
      name - column name
      grouped - true if the column is grouped; false otherwise
      data - column data (long integers representing nanos since the epoch)
      Returns:
      a DBDateTime column holder implemented with longs for storage
    • getBooleanColumnHolder

      public static ColumnHolder getBooleanColumnHolder​(String name, boolean grouped, byte... data)
      Create a column holder for a Boolean column where the calues are represented as bytes. The given byte array will be converted to a Boolean array.
      Parameters:
      name - column name
      grouped - true if the column is grouped; false otherwise
      data - column data (byte values where 1 represents true, 0 represents false, and null otherwise)
      Returns:
      a Boolean column holder
    • getColumnHolderFromArray

      public static ColumnHolder getColumnHolderFromArray​(String name, boolean grouped, Object data)
      Create a column holder from an array object, inferring the data type from the given array object.
      Parameters:
      name - column name
      grouped - true if the column is grouped; false otherwise
      data - an object holding the column data (must be an array)
      Returns:
      a column holder with a type matching the component type of the provided array
    • getColumnSource

      public ColumnSource getColumnSource()
      Gets a column source for the data. Other than the special case of DBDateTime columns, this requires that the type specified match the component type of the actual data.
      Returns:
      column source constructed with data from this column holder
    • getArrayData

      public Optional<Object> getArrayData()
    • getChunkData

      public Optional<Chunk<Attributes.Values>> getChunkData()
    • getChunk

      public Chunk<Attributes.Values> getChunk()
    • size

      public int size()