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
|
Tuple |
deserialize(byte[] k,
byte[] v) |
ColumnDefinition |
getColumnDefinition(String cname) |
ColumnSerializer |
getColumnSerializer(String columnName) |
String |
getDataDir() |
com.google.common.collect.BiMap<String,Short> |
getEnumValues(String columnName) |
int |
getFormatVersion() |
List<String> |
getHistogramColumns() |
TupleDefinition |
getKeyDefinition() |
String |
getName() |
PartitioningSpec |
getPartitioningSpec() |
TableDefinition.PartitionStorage |
getPartitionStorage() |
String |
getStorageEngineName() |
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)
sets dataDir to this value
|
void |
setDb(YarchDatabase 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) |
void |
setStorageEngineName(String storageEngineName) |
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 TableDefinition(String name, TupleDefinition tdef, List<String> primaryKey) throws StreamSqlException
name - tdef - primaryKey - StreamSqlExceptionpublic void setDb(YarchDatabase 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()
public String getDataDir()
public void setDataDir(String dataDir)
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 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)
public TableDefinition.PartitionStorage getPartitionStorage()
public void setPartitionStorage(TableDefinition.PartitionStorage partitionStorage)
public boolean isPartitionedByValue()
public int getFormatVersion()
Copyright © 2017 Space Applications Services. All rights reserved.