java.lang.Object
org.apache.arrow.vector.table.BaseTable
- All Implemented Interfaces:
AutoCloseable
- Direct Known Subclasses:
Table
Abstract base class for Table.
This API is EXPERIMENTAL.
-
Field Summary
Modifier and TypeFieldDescriptionprotected DictionaryProvider
An optional DictionaryProvider.protected final List<FieldVector>
The field vectors holding the data in this table.protected final Map<Field,
FieldVector> A map of Fields to FieldVectors used to select Fields.protected int
The number of rows of data in the table; not necessarily the same as the table row capacity.protected Schema
The schema for the table. -
Constructor Summary
ConstructorDescriptionBaseTable
(List<FieldVector> fieldVectors, int rowCount, DictionaryProvider provider) Constructs new instance with the given rowCount, and containing the schema and each of the given vectors. -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Closes all the vectors holding data for this table.Returns a tab separated value of vectors (based on their java object representation).Returns a ValueVector containing the decoded version of the vector with the given name.Returns a ValueVector containing the encoded version of the vector with the given name.Returns the DictionaryProvider for this table.Returns the Field with the given name if one exists in this table.getReader
(int index) Returns a FieldReader for the field at the given vector index.Returns a FieldReader for the vector with the given name.Returns a FieldReader for the given field.long
Returns the number of rows in this table.Returns the schema for this Table.getVectorCopy
(int columnIndex) Returns a copy of the vector at the given position.getVectorCopy
(String columnName) Returns a copy of the vector with the given name, or throws IllegalArgumentException if the name is not found.int
Returns the number of vectors (columns) in this table.Returns an immutable Row object holding a reference to this table.boolean
isRowDeleted
(int rowNumber) Returns true if the row at the given index has been deleted and false otherwise.Returns a new VectorSchemaRoot with the data and schema from this table.
-
Field Details
-
fieldVectors
The field vectors holding the data in this table. -
dictionaryProvider
An optional DictionaryProvider. One must be present if any vector in the table is dictionary encoded. -
fieldVectorsMap
A map of Fields to FieldVectors used to select Fields. -
schema
The schema for the table. -
rowCount
protected int rowCountThe number of rows of data in the table; not necessarily the same as the table row capacity.
-
-
Constructor Details
-
BaseTable
Constructs new instance with the given rowCount, and containing the schema and each of the given vectors.- Parameters:
fieldVectors
- the FieldVectors containing the table's datarowCount
- the number of rows in the tableprovider
- a dictionary provider, may be null if none of the vectors in the table are encoded
-
-
Method Details
-
getReader
Returns a FieldReader for the vector with the given name.- Parameters:
name
- The name of a vector in this Table (case-sensitive)- Returns:
- A FieldReader for the named FieldVector
-
getReader
Returns a FieldReader for the given field.- Parameters:
field
- The field to be read- Returns:
- A FieldReader for the given field
-
getReader
Returns a FieldReader for the field at the given vector index.- Parameters:
index
- The 0-based index of the field desired.- Returns:
- A FieldReader for the requested field
-
getSchema
Returns the schema for this Table. -
getField
Returns the Field with the given name if one exists in this table.- Parameters:
fieldName
- the name of the field to return- Returns:
- a field with the given name if one is present
- Throws:
IllegalArgumentException
- – if the field was not found
-
getVectorCount
public int getVectorCount()Returns the number of vectors (columns) in this table. -
close
public void close()Closes all the vectors holding data for this table.- Specified by:
close
in interfaceAutoCloseable
-
getRowCount
public long getRowCount()Returns the number of rows in this table. -
toVectorSchemaRoot
Returns a new VectorSchemaRoot with the data and schema from this table. Data is transferred to the new VectorSchemaRoot, so this table is cleared and the rowCount is set to 0;- Returns:
- a new VectorSchemaRoot
-
getVectorCopy
Returns a copy of the vector with the given name, or throws IllegalArgumentException if the name is not found. Names are case-sensitive.- Parameters:
columnName
- The name of the vector to copy- Returns:
- A copy of the Vector with the given name
- Throws:
IllegalArgumentException
- if the name is not the name of a vector in the table.
-
getVectorCopy
Returns a copy of the vector at the given position.- Parameters:
columnIndex
- The 0-based position of the vector to be copied
-
immutableRow
Returns an immutable Row object holding a reference to this table. The default character encoding used by the cursor to decode Strings will be StandardCharsets.UTF_8 as this is the only charset supported in Arrow format. -
contentToTSVString
Returns a tab separated value of vectors (based on their java object representation). -
isRowDeleted
public boolean isRowDeleted(int rowNumber) Returns true if the row at the given index has been deleted and false otherwise.If the index is larger than the number of rows, the method returns true.
- Parameters:
rowNumber
- The 0-based index of the possibly deleted row- Returns:
- true if the row at the index was deleted; false otherwise
-
getDictionaryProvider
Returns the DictionaryProvider for this table. It can be used to decode an encoded values -
decode
Returns a ValueVector containing the decoded version of the vector with the given name.- Parameters:
vectorName
- The name of the vector to decodedictionaryId
- The identifier for the dictionary to use when decoding. Must match the id returned by the dictionary's getId() method.- Returns:
- A ValueVector
-
encode
Returns a ValueVector containing the encoded version of the vector with the given name.- Parameters:
vectorName
- The name of the vector to encodedictionaryId
- The identifier for the dictionary to use when encoding. Must match the id returned by the dictionary's getId() method.- Returns:
- A ValueVector
-