Package com.illumon.iris.binarystore
Class BinaryStoreWriterV1
java.lang.Object
com.illumon.iris.binarystore.AbstractBinaryStoreWriter
com.illumon.iris.binarystore.BinaryStoreWriterV1
- All Implemented Interfaces:
Entry
,Record
,Row
,TableWriter
- Direct Known Subclasses:
BinaryStoreWriter
public class BinaryStoreWriterV1 extends AbstractBinaryStoreWriter
This class implements the writer for a self-descriptive binary table.
A table is structured as following:
The header contains a sequence of:
- columnName:zero terminated string
- columnType:zero terminated string (e.g., String, Byte, Integer, BLOB)
- fixedTypeSize:int (for string and blob this is zero)
- typeMetadata:<int size><n bytes>, most types do not require meta-data. The metadata for an Enum is a mapping from the corresponding integer to string name.
The header is followed by row data.
A row is formatted as follows:
- mask, which is bitmap indicating which columns exist within the row, stored as an array of bytes of size (ncols+7)/8
- fixed size records are stored using predefined size, The minimum value of integer-like types indicates nullability. For boolean's and enum's -1 indicates nullability.
- for each variable size record (i.e. Strings and blobs), 2 bytes for entry size followed by the payload
- enum's are stored as a an integer, The Metadata is used to map the integer to a string representation.
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.illumon.iris.binarystore.Record
Record.RecordSetter<T extends RecordData>
-
Field Summary
-
Constructor Summary
Constructors Constructor Description BinaryStoreWriterV1(com.fishlib.io.logger.Logger log, String logDir, String namespace, String tablename, TableIdentifier.NamespaceSet namespaceSet, String internalPartition, String[] columnNames, SupportedType[] columnTypes, Object[] typeMetadata, Map<String,Object> constantColumnValues, int applicationVersion, ZoneId zoneId)
BinaryStoreWriterV1(String path, String[] columnNames, SupportedType[] columnTypes, Object[] typeMetadata, com.fishlib.io.logger.Logger log)
BinaryStoreWriterV1(String path, String[] columnNames, SupportedType[] columnTypes, Object[] typeMetadata, DateFormat rollFormat, com.fishlib.io.logger.Logger log)
BinaryStoreWriterV1(String path, String[] columnNames, SupportedType[] columnTypes, Object[] typeMetadata, DateFormat rollFormat, Map<String,Object> constantValues, int applicationVersion, com.fishlib.io.logger.Logger log)
BinaryStoreWriterV1(String path, String[] columnNames, SupportedType[] columnTypes, Object[] typeMetadata, DateFormat rollFormat, Map<String,Object> constantValue, com.fishlib.io.logger.Logger log)
BinaryStoreWriterV1(String path, String[] columnNames, SupportedType[] columnTypes, Object[] typeMetadata, Map<String,Object> constantValues, int applicationVersion, com.fishlib.io.logger.Logger log)
BinaryStoreWriterV1(String path, String[] columnNames, SupportedType[] columnTypes, Object[] typeMetadata, Map<String,Object> constantValues, com.fishlib.io.logger.Logger log)
-
Method Summary
Modifier and Type Method Description WritableByteChannel
getChannel()
String[]
getColumnNames()
Gets the column names for the table.Class[]
getColumnTypes()
Gets the column types for the table.BinaryRow
getRowWriter()
Get a writer for a Row entries.RowSetter
getSetter(String name)
Gets a setter for a column.void
setFlags(Row.Flags flags)
long
size()
Number of rows written out.void
writeRow()
Writes out a new row (values set using setters).Methods inherited from class com.illumon.iris.binarystore.AbstractBinaryStoreWriter
close, flush, setChannelManager, supportAllTypes
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.illumon.iris.binarystore.Row
getColumnPartitionValue, setColumnPartitionValue
Methods inherited from interface com.illumon.iris.binarystore.TableWriter
flushDeferredRows, getRecordSetter, getRecordSetter, getRecordWriter, getSetter, writeDeferredRow, writeRecord
-
Constructor Details
-
BinaryStoreWriterV1
public BinaryStoreWriterV1(String path, String[] columnNames, SupportedType[] columnTypes, Object[] typeMetadata, com.fishlib.io.logger.Logger log) throws IOException- Throws:
IOException
-
BinaryStoreWriterV1
public BinaryStoreWriterV1(String path, String[] columnNames, SupportedType[] columnTypes, Object[] typeMetadata, Map<String,Object> constantValues, com.fishlib.io.logger.Logger log) throws IOException- Throws:
IOException
-
BinaryStoreWriterV1
public BinaryStoreWriterV1(String path, String[] columnNames, SupportedType[] columnTypes, Object[] typeMetadata, Map<String,Object> constantValues, int applicationVersion, com.fishlib.io.logger.Logger log) throws IOException- Throws:
IOException
-
BinaryStoreWriterV1
public BinaryStoreWriterV1(String path, String[] columnNames, SupportedType[] columnTypes, Object[] typeMetadata, DateFormat rollFormat, com.fishlib.io.logger.Logger log) throws IOException- Throws:
IOException
-
BinaryStoreWriterV1
public BinaryStoreWriterV1(String path, String[] columnNames, SupportedType[] columnTypes, Object[] typeMetadata, DateFormat rollFormat, Map<String,Object> constantValue, com.fishlib.io.logger.Logger log) throws IOException- Throws:
IOException
-
BinaryStoreWriterV1
public BinaryStoreWriterV1(String path, String[] columnNames, SupportedType[] columnTypes, Object[] typeMetadata, DateFormat rollFormat, Map<String,Object> constantValues, int applicationVersion, com.fishlib.io.logger.Logger log) throws IOException- Throws:
IOException
-
BinaryStoreWriterV1
public BinaryStoreWriterV1(com.fishlib.io.logger.Logger log, String logDir, String namespace, String tablename, TableIdentifier.NamespaceSet namespaceSet, String internalPartition, String[] columnNames, SupportedType[] columnTypes, Object[] typeMetadata, Map<String,Object> constantColumnValues, int applicationVersion, ZoneId zoneId) throws IOException- Throws:
IOException
-
-
Method Details
-
getChannel
- Throws:
IOException
-
getRowWriter
Description copied from interface:TableWriter
Get a writer for a Row entries. This is likely to be newly created, so callers should cache this value. In practice, TableWriter implementations generally cache the result of the first call to this method as a primary writer.- Returns:
- a Row, likely newly created
-
getSetter
Description copied from interface:TableWriter
Gets a setter for a column.The implementation is likely to delegate to
Row.getSetter(String)
in a default Row instance.- Parameters:
name
- column name- Returns:
- setter for the column.
-
setFlags
Description copied from interface:TableWriter
The implementation is likely to delegate to
Row.setFlags(Flags)
in a default Row instance. -
writeRow
Description copied from interface:TableWriter
Writes out a new row (values set using setters).The implementation is likely to delegate to
Row.writeRow()
in a default Row instance.- Throws:
IOException
- problem writing the row
-
getColumnTypes
Description copied from interface:TableWriter
Gets the column types for the table.- Returns:
- column types for the table.
-
getColumnNames
Description copied from interface:TableWriter
Gets the column names for the table.- Returns:
- column names for the table.
-
size
public long size()Description copied from interface:Row
Number of rows written out.- Returns:
- number of rows written out.
-