public class DatasetBuilder extends Object implements CloseableTokenAppendable
ReadStagingDataset
outside of an engine context.
This is intended for use in non-parallel contexts or for simple unit tests.
For a scalable implementation, please use WriteStagingDataset
.
NOTE: Current implementation only supports record data-sets.
Constructor and Description |
---|
DatasetBuilder(FileClient client,
Path dataset,
int bufferSize,
TokenEncodings baseEncodings,
RecordTokenType type,
WriteMode mode,
int blockSize)
Creates and opens the builder.
|
DatasetBuilder(FileClient client,
String dataset,
int bufferSize,
TokenEncodings baseEncodings,
WriteMode mode,
RecordTokenType type)
Creates and opens the builder.
|
Modifier and Type | Method and Description |
---|---|
void |
append(TokenSequence data)
Appends all tokens in the specified sequence to this
sequence.
|
void |
append(TokenSequence data,
int start,
int length)
Appends a subsequence of tokens in the specified sequence
to this sequence.
|
void |
append(TokenValued value)
Appends the specified token value to this sequence.
|
void |
append(TokenValued value,
long count)
Appends the specified token value to this sequence
multiple times.
|
void |
close() |
public DatasetBuilder(FileClient client, String dataset, int bufferSize, TokenEncodings baseEncodings, WriteMode mode, RecordTokenType type)
close()
.client
- the file clientdataset
- the dataset filebufferSize
- the disk buffer sizebaseEncodings
- token encodings instance to use. Must match that used to encode.mode
- the write modetype
- the record type of the datasetpublic DatasetBuilder(FileClient client, Path dataset, int bufferSize, TokenEncodings baseEncodings, RecordTokenType type, WriteMode mode, int blockSize)
close()
.client
- the file clientdataset
- the dataset filebufferSize
- the disk buffer sizebaseEncodings
- token encodings instance to use. Must match that used to encode.mode
- the write modetype
- the record type of the datasetblockSize
- the block size to use when encoding datapublic void close()
close
in interface CloseableTokenAppendable
close
in interface Closeable
close
in interface AutoCloseable
public void append(TokenValued value)
TokenAppendable
The data types of the sequence and the value must be compatible. If the types are not identical, appropriate coercion will be attempted.
append
in interface TokenAppendable
value
- the token value to appendpublic void append(TokenValued value, long count)
TokenAppendable
The data types of the sequence and the value must be compatible. If the types are not identical, appropriate coercion will be attempted.
append
in interface TokenAppendable
value
- the token value to appendcount
- the number of copies to appendpublic void append(TokenSequence data)
TokenAppendable
The data types of the sequences must be compatible. If not identical, appropriate coercion will be attempted.
append
in interface TokenAppendable
data
- the sequence to appendpublic void append(TokenSequence data, int start, int length)
TokenAppendable
The data types of the sequences must be compatible. If not identical, appropriate coercion will be attempted.
append
in interface TokenAppendable
data
- the sequence containing tokens to appendstart
- the starting index of the subsequence in the sourcelength
- the length of the subsequenceCopyright © 2020 Actian Corporation. All rights reserved.