@InterfaceAudience.Public @InterfaceStability.Evolving public class Schema extends Object
Constructor and Description |
---|
Schema(List<ColumnSchema> columns)
Constructs a schema using the specified columns and does some internal accounting
|
Schema(List<ColumnSchema> columns,
List<Integer> columnIds)
Constructs a schema using the specified columns and IDs.
|
Modifier and Type | Method and Description |
---|---|
ColumnSchema |
getColumn(String columnName)
Get the column associated with the specified name
|
ColumnSchema |
getColumnByIndex(int idx)
Get the column at the specified index in the original list
|
int |
getColumnCount()
Get the count of columns in this schema
|
int |
getColumnIndex(int columnId)
Get the column index of the column with the provided ID.
|
int |
getColumnIndex(String columnName)
Get the index for the provided column name.
|
int |
getColumnOffset(int idx)
Get the index at which this column can be found in the backing byte array
|
List<ColumnSchema> |
getColumns()
Get the list of columns used to create this schema
|
int |
getPrimaryKeyColumnCount()
Get the count of columns that are part of the primary key.
|
List<ColumnSchema> |
getPrimaryKeyColumns()
Get the primary key columns.
|
Schema |
getRowKeyProjection()
Get a schema that only contains the columns which are part of the key
|
int |
getRowSize()
Get the size a row built using this schema would be
|
int |
getVarLengthColumnCount()
Get the count of columns with variable length (BINARY/STRING) in
this schema.
|
boolean |
hasColumn(String columnName)
Returns true if the column exists.
|
boolean |
hasColumnIds()
Tells whether this schema includes IDs for columns.
|
boolean |
hasNullableColumns()
Tells if there's at least one nullable column
|
PartialRow |
newPartialRow()
Creates a new partial row for the schema.
|
public Schema(List<ColumnSchema> columns)
columns
- the columns in index order
See ColumnPBsToSchema()
in src/kudu/common/wire_protocol.cc
public Schema(List<ColumnSchema> columns, List<Integer> columnIds)
Schema(List)
to create a new schema.columns
- the columns in index ordercolumnIds
- the column ids of the provided columns, or nullIllegalArgumentException
- If the column ids length does not match the columns length
See ColumnPBsToSchema()
in src/kudu/common/wire_protocol.cc
public List<ColumnSchema> getColumns()
public int getVarLengthColumnCount()
public int getRowSize()
public int getColumnOffset(int idx)
idx
- column's indexpublic boolean hasColumn(String columnName)
columnName
- column to search forpublic int getColumnIndex(String columnName)
columnName
- column to search forpublic int getColumnIndex(int columnId)
columnId
- the column id of the columnpublic ColumnSchema getColumnByIndex(int idx)
idx
- column's indexpublic ColumnSchema getColumn(String columnName)
columnName
- column's namepublic int getColumnCount()
public int getPrimaryKeyColumnCount()
public List<ColumnSchema> getPrimaryKeyColumns()
public Schema getRowKeyProjection()
public boolean hasNullableColumns()
public boolean hasColumnIds()
public PartialRow newPartialRow()