public class TableDefinition extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
TableDefinition.PartitionStorage |
| Modifier and Type | Field and Description |
|---|---|
static int |
CURRENT_FORMAT_VERSION |
| Constructor and Description |
|---|
TableDefinition(String name,
TupleDefinition tdef,
List<String> primaryKey)
Used when creating an "empty"(i.e.
|
| Modifier and Type | Method and Description |
|---|---|
Short |
addAndGetEnumValue(String columnName,
String value)
get the enum value corresponding to a column, creating it if it does not
exist
|
void |
changeFormatDefinition(int formatVersion)
Changes the formatVersion and serializes the table definition to disk
|
void |
changeStorageEngineName(String newStorageEngineName) |
Tuple |
deserialize(byte[] k,
byte[] v) |
ColumnDefinition |
getColumnDefinition(String cname) |
ColumnSerializer |
getColumnSerializer(String columnName) |
String |
getDataDir()
Deprecated.
- used by the oldrocksdb - for the new one tablespaces can be
used
|
com.google.common.collect.BiMap<String,Short> |
getEnumValues(String columnName) |
int |
getFormatVersion() |
List<String> |
getHistogramColumns() |
TupleDefinition |
getKeyDefinition() |
String |
getName() |
PartitioningSpec |
getPartitioningSpec() |
TableDefinition.PartitionStorage |
getPartitionStorage()
Deprecated.
used for the oldrocksdb
|
String |
getStorageEngineName() |
String |
getTablespaceName() |
TupleDefinition |
getTupleDefinition() |
TupleDefinition |
getValueDefinition() |
boolean |
hasCustomDataDir() |
boolean |
hasHistogram() |
boolean |
hasPartitioning() |
boolean |
isCompressed() |
boolean |
isIndexedByKey(String cname) |
boolean |
isPartitionedByValue() |
void |
renameColumn(String oldName,
String newName)
Renames column and serializes the table definition to disk.
|
byte[] |
serializeKey(Tuple t)
Transforms the key part of the tuple into a byte array to be written to
disk.
|
byte[] |
serializeValue(Tuple t)
Transform the value part of the tuple into a byte array to be written on
disk.
|
void |
setCompressed(boolean compressed) |
void |
setCustomDataDir(boolean customDataDir)
sets the customDataDir - if true, the dataDir will not be discarded after
serialisation, so the next time the server is restarted it will stay to
the set value.
|
void |
setDataDir(String dataDir)
Deprecated.
- used by the oldrocksdb - for the new one tablespaces can be
used
|
void |
setDb(YarchDatabaseInstance ydb) |
void |
setHistogramColumns(List<String> histoColumns) |
void |
setName(String name) |
void |
setPartitioningSpec(PartitioningSpec pspec)
time based partitions can be on the first column of the key (which has to
be of type timestamp) value based partitions can be on any other
mandatory column
|
void |
setPartitionStorage(TableDefinition.PartitionStorage partitionStorage)
Deprecated.
used for the oldrocksdb
|
void |
setStorageEngineName(String storageEngineName) |
void |
setTablespaceName(String tablespaceName) |
String |
toString() |
void |
validate()
Checks that the table definition is valid: - primary key not string,
except for the last in the list (otherwise the binary sorting does not
work properly)
|
public static final int CURRENT_FORMAT_VERSION
public TableDefinition(String name, TupleDefinition tdef, List<String> primaryKey) throws StreamSqlException
name - tdef - primaryKey - StreamSqlExceptionpublic void setDb(YarchDatabaseInstance ydb)
public void setPartitioningSpec(PartitioningSpec pspec) throws StreamSqlException
pspec - StreamSqlExceptionpublic TupleDefinition getKeyDefinition()
public TupleDefinition getValueDefinition()
public String getName()
public void setName(String name)
public void setCustomDataDir(boolean customDataDir)
customDataDir - public boolean hasCustomDataDir()
@Deprecated public String getDataDir()
@Deprecated public void setDataDir(String dataDir)
public TupleDefinition getTupleDefinition()
public void validate()
throws StreamSqlException
StreamSqlExceptionpublic byte[] serializeKey(Tuple t)
t - public void changeFormatDefinition(int formatVersion)
formatVersion - new format versionpublic void changeStorageEngineName(String newStorageEngineName)
public void renameColumn(String oldName, String newName)
oldName - - old name of the columnnewName - - new name of the columnpublic Short addAndGetEnumValue(String columnName, String value)
public byte[] serializeValue(Tuple t)
t - public Tuple deserialize(byte[] k, byte[] v)
public boolean isCompressed()
public boolean isIndexedByKey(String cname)
cname - the column namepublic ColumnDefinition getColumnDefinition(String cname)
public boolean hasPartitioning()
public PartitioningSpec getPartitioningSpec()
public void setCompressed(boolean compressed)
public void setHistogramColumns(List<String> histoColumns) throws StreamSqlException
StreamSqlExceptionpublic boolean hasHistogram()
public ColumnSerializer getColumnSerializer(String columnName)
public String getStorageEngineName()
public void setStorageEngineName(String storageEngineName)
@Deprecated public TableDefinition.PartitionStorage getPartitionStorage()
@Deprecated public void setPartitionStorage(TableDefinition.PartitionStorage partitionStorage)
public boolean isPartitionedByValue()
public int getFormatVersion()
public String getTablespaceName()
public void setTablespaceName(String tablespaceName)
Copyright © 2018 Space Applications Services. All rights reserved.