Class Table

java.lang.Object
org.apache.arrow.vector.table.BaseTable
org.apache.arrow.vector.table.Table
All Implemented Interfaces:
AutoCloseable, Iterable<Row>

public class Table extends BaseTable implements Iterable<Row>
Table is an immutable tabular data structure.

See VectorSchemaRoot for batch processing use cases

This API is EXPERIMENTAL.

  • Constructor Details

    • Table

      public Table(Iterable<FieldVector> vectors)
      Constructs new instance containing each of the given vectors.
    • Table

      public Table(List<FieldVector> fieldVectors)
      Constructs a new instance with the number of rows set to the value count of the first FieldVector.

      All vectors must have the same value count. Although this is not checked, inconsistent counts may lead to exceptions or other undefined behavior later.

      Parameters:
      fieldVectors - The data vectors (must be equal in size to fields.
    • Table

      public Table(List<FieldVector> fieldVectors, int rowCount)
      Constructs a new instance.
      Parameters:
      fieldVectors - The data vectors.
      rowCount - The number of rows
    • Table

      public Table(List<FieldVector> fieldVectors, int rowCount, DictionaryProvider provider)
      Constructs a new instance.
      Parameters:
      fieldVectors - The data vectors.
      rowCount - The number of rows
      provider - A dictionary provider. May be null if none of the vectors is dictionary encoded
    • Table

      public Table(VectorSchemaRoot vsr)
      Constructs a new instance containing the data from the argument. Vectors are shared between the Table and VectorSchemaRoot. Direct modification of those vectors is unsafe and should be avoided.
      Parameters:
      vsr - The VectorSchemaRoot providing data for this Table
  • Method Details

    • of

      public static Table of(FieldVector... vectors)
      Constructs a new instance from vectors.
    • copy

      public Table copy()
      Returns a deep copy of this table.
    • addVector

      public Table addVector(int index, FieldVector vector)
      Returns a new Table created by adding the given vector to the vectors in this Table.
      Parameters:
      index - field index
      vector - vector to be added.
      Returns:
      out a new Table with vector added
    • removeVector

      public Table removeVector(int index)
      Returns a new Table created by removing the selected Vector from this Table.
      Parameters:
      index - field index
      Returns:
      out a new Table with vector removed
    • slice

      public Table slice(int index)
      Slice this table from desired index. Memory is NOT transferred from the vectors in this table to new vectors in the target table. This table is unchanged.
      Parameters:
      index - start position of the slice
      Returns:
      the sliced table
    • slice

      public Table slice(int index, int length)
      Slice this table at desired index and length. Memory is NOT transferred from the vectors in this table to new vectors in the target table. This table is unchanged.
      Parameters:
      index - start position of the slice
      length - length of the slice
      Returns:
      the sliced table
    • iterator

      public Iterator<Row> iterator()
      Returns a Row iterator for this Table.
      Specified by:
      iterator in interface Iterable<Row>