public final class DatasetIterator extends Object implements CloseableRecordValuedIterator
WriteStagingDataset
outside of an engine context.
This is intended for use in non-parallel contexts (i.e. a viewer for the UI) or for simple unit tests.
For a scalable implementation, please use ReadStagingDataset
.
NOTE: Current implementation only supports record data-sets.
Constructor and Description |
---|
DatasetIterator(FileClient fileClient,
Path dataset,
int bufferSize,
TokenEncodings baseEncodings)
Creates and opens the iterator.
|
DatasetIterator(FileClient fileClient,
String dataset,
int bufferSize,
TokenEncodings baseEncodings)
Creates and opens the iterator.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the iterator and releases any resources.
|
boolean |
containsNull()
Determines if any field in the record is null valued.
|
int |
getAbsoluteIndex()
Returns the dense value index for the current value.
|
Path |
getDataset()
loads the next buffer
|
ScalarValued |
getField(int index)
Get the field at the given index within the list of fields.
|
ScalarValued |
getField(String fieldName)
Gets the value of the field with the given name.
|
ScalarValued[] |
getFields()
Gets the values of all fields in the record
|
long |
getPosition()
Gets the current record number in the dataset.
|
RecordTokenType |
getType()
Gets the data type of the token.
|
boolean |
isNull()
Indicates whether the token is null valued.
|
boolean |
isOpen()
Indicates whether the iterator is still open.
|
ScalarValuedIterator |
newFieldIterator(FieldIteratorProperties properties)
Create a new iterator for visiting the fields in this RecordValued object.
|
ScalarValuedIterator |
newFieldIterator(ScalarTokenType type)
Create a new iterator for visiting the fields in this RecordValued object.
|
ScalarValuedIterator |
newFieldIterator(ScalarTokenType type,
String[] selectedFieldNames)
Create a new iterator for visiting the fields in this RecordValued object.
|
void |
resetIteration()
Resets the iteration to the beginning.
|
int |
size()
Gets the number of fields in the record schema.
|
boolean |
stepNext()
Advances to the next value not equal to "zero".
|
public DatasetIterator(FileClient fileClient, String dataset, int bufferSize, TokenEncodings baseEncodings)
close()
.fileClient
- the file clientdataset
- the dataset filebufferSize
- the disk buffer sizebaseEncodings
- token encodings instance to use. Must match that used to encode.public DatasetIterator(FileClient fileClient, Path dataset, int bufferSize, TokenEncodings baseEncodings)
close()
.fileClient
- the file clientdataset
- the dataset filebufferSize
- the disk buffer sizebaseEncodings
- token encodings instance to use. Must match that used to encode.public Path getDataset()
public boolean stepNext()
TokenValuedIterator
stepNext
in interface TokenValuedIterator
public boolean isOpen()
true
if the iterator is still open,
false
if it has been closed.close()
public void close()
close
in interface CloseableRecordValuedIterator
close
in interface Closeable
close
in interface AutoCloseable
public int getAbsoluteIndex()
TokenValuedIterator
RecordTokenType.get(denseIndex)
will
return the associated field.
NOTE: Iteration order is unspecified on this interface. Some implementations guarantee sort order whereas others do not. Please refer to the documentation on the factory method from which this iterator was constructed for ordering information.
getAbsoluteIndex
in interface TokenValuedIterator
public long getPosition()
public void resetIteration()
TokenValuedIterator
resetIteration
in interface TokenValuedIterator
public RecordTokenType getType()
TokenValued
getType
in interface RecordValued
getType
in interface TokenValued
getType
in interface RecordTyped
getType
in interface TokenTyped
public boolean isNull()
TokenValued
isNull
in interface TokenValued
true
if the token is null valued,
false
otherwisepublic boolean containsNull()
RecordValued
containsNull
in interface RecordValued
true
if at least one field is null
valued, false
if none arepublic int size()
RecordValued
size
in interface RecordValued
public ScalarValued[] getFields()
RecordValued
getFields
in interface RecordValued
public ScalarValued getField(String fieldName)
RecordValued
getField
in interface RecordValued
fieldName
- the field namepublic ScalarValued getField(int index)
RecordValued
getField
in interface RecordValued
index
- zero-based index into the field listpublic ScalarValuedIterator newFieldIterator(ScalarTokenType type)
RecordValued
newFieldIterator
in interface RecordValued
type
- the type of fields over which to iteratepublic ScalarValuedIterator newFieldIterator(ScalarTokenType type, String[] selectedFieldNames)
RecordValued
newFieldIterator
in interface RecordValued
type
- the type of fields over which to iterateselectedFieldNames
- the fields over which to iteratepublic ScalarValuedIterator newFieldIterator(FieldIteratorProperties properties)
RecordValued
FieldIteratorProperties.isSorted()
.newFieldIterator
in interface RecordValued
properties
- properties for the iteratorCopyright © 2019 Actian Corporation. All rights reserved.