public class LocalFileDataset extends Dataset
Dataset.ColumnsDataReader
internalId, internalName, log, TIMESTAMP_FORMAT
SERIALIZED_CLASS_NAME, TYPE
XML_SERIALIZED_CLASS_NAME
Modifier | Constructor and Description |
---|---|
protected |
LocalFileDataset(String rootFolder,
String fileNamePrefix) |
protected |
LocalFileDataset(String rootFolder,
String fileNamePrefix,
AbstractPipeline pipeline) |
Modifier and Type | Method and Description |
---|---|
DataException |
addExceptionProperties(DataException exception)
Adds this object's current state to a
DataException . |
protected void |
afterColumnStatsLoaded()
Called during the data loading process after all the column stats have been loaded.
|
protected void |
afterLoad()
Called at the end of the data loading process after all the records and column stats have been loaded.
|
protected void |
beforeLoad()
Called at the start of the data loading process, but before any records or column stats have been loaded.
|
void |
close() |
static LocalFileDataset |
createDataset(String rootFolder,
String fileNamePrefix,
AbstractPipeline pipeline)
Creates a persistent dataset on disk in the specified
rootFolder directory. |
static LocalFileDataset |
createDataset(String rootFolder,
String fileNamePrefix,
DataReaderFactory dataReaderFactory)
Creates a persistent dataset on disk in the specified
rootFolder directory. |
protected DataWriter |
createDataWriter()
Writes records to this dataset's cache after clearing it.
|
static LocalFileDataset |
createTempDataset(String rootFolder,
String fileNamePrefix,
AbstractPipeline pipeline)
Creates a temporary dataset on disk that will be deleted when the dataset is closed or when the JVM exits.
|
static LocalFileDataset |
createTempDataset(String rootFolder,
String fileNamePrefix,
DataReaderFactory dataReaderFactory)
Creates a temporary dataset on disk that will be deleted when the dataset is closed or when the JVM exits.
|
Column |
getColumn(int index) |
Column |
getColumn(String name) |
long |
getColumnCount() |
List<String> |
getColumnNames() |
List<Column> |
getColumns() |
protected File |
getDataFile(long fileIndex) |
protected File |
getMetadataFile() |
protected Column |
getOrCreateColumn(String name,
int index) |
Record |
getRecord(long index) |
long |
getRecordCount() |
RecordList |
getRecordList(long offset,
int count)
Get a subset of the records cached in this dataset.
|
int |
getRecordsPerFile() |
protected File |
getStatsFile() |
boolean |
isDeleteFilesOnClose() |
LocalFileDataset |
load(Integer maxRecords,
JobCallback<DataReader,DataWriter> callback)
Starts the asynchronous loading of records from the pipeline into this dataset.
|
static LocalFileDataset |
openDataset(String rootFolder,
String fileNamePrefix)
Loads an existing dataset from the specified
rootFolder & fileNamePrefix . |
LocalFileDataset |
setDeleteFilesOnClose(boolean deleteFilesOnClose) |
LocalFileDataset |
setPipeline(AbstractPipeline pipeline) |
LocalFileDataset |
setRecordsPerFile(int recordsPerFile) |
addField, afterRecordsLoaded, cancelLoad, createColumnsDataReader, createDataReader, createDataReader, finalize, forEach, fromRecord, getColumnStatsException, getColumnStatsReaderThreads, getDataLoadException, getJob, getMaxColumnStatsRecords, getMaxRecordsToLoad, getPipeline, isCollectUniqueValues, isColumnStatsLoaded, isDataLoaded, isDataLoading, isDetectBigNumberValues, isDetectBooleanValues, isDetectNumericValues, isDetectTemporalValues, isDetectUuidValues, isInferStringTypes, isRecordsLoaded, iterator, load, load, setCollectUniqueValues, setColumnStatsLoaded, setColumnStatsReaderThreads, setDetectBigNumberValues, setDetectBooleanValues, setDetectNumericValues, setDetectTemporalValues, setDetectUuidValues, setInferStringTypes, setMaxColumnStatsRecords, setRecordsLoaded, stream, toRecord, updateColumns, waitForColumnStatsToLoad, waitForColumnStatsToLoad, waitForRecordsToLoad, waitForRecordsToLoad, waitUntilJobFinished
assertValid, assertValid, clone, exception, exception, exception, getInternalId, getInternalName, resetInternalId
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
spliterator
fromArrayValue, fromArrayValue, fromArrayValue, fromJson, fromJson, newInstanceFromRecord, newInstanceFromRecord, toArrayValue, toJson, toJson, toJson, toRecord
newInstanceFromJson
forEachGrandChildElement, fromXml, fromXml, fromXmlElement, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getChildElement, getChildElements, newInstanceFromXml, newInstanceFromXml, setAttribute, toXml, toXml, toXml, toXml, toXml, toXmlElement, writeXml, writeXml
addExceptionProperties, contributeExceptionProperties, contributeExceptionProperties
protected LocalFileDataset(String rootFolder, String fileNamePrefix, AbstractPipeline pipeline)
public static LocalFileDataset createTempDataset(String rootFolder, String fileNamePrefix, DataReaderFactory dataReaderFactory)
null
),
using the prefix "dataset-" and suffix ".mvstore" to generate its name.rootFolder
- the directory to store the temporary file or null
to use the default temporary-file directory.fileNamePrefix
- the base file name of data & stats.dataReaderFactory
- the source of the dataset's datapublic static LocalFileDataset createTempDataset(String rootFolder, String fileNamePrefix, AbstractPipeline pipeline)
rootFolder
- the directory to store the temporary file or null
to use the default temporary-file directory.fileNamePrefix
- the base file name of data & stats.pipeline
- the source of the dataset's datapublic static LocalFileDataset createDataset(String rootFolder, String fileNamePrefix, DataReaderFactory dataReaderFactory)
rootFolder
directory.
The data & stats files will remain on disk even after the dataset is closed and the JVM exits.rootFolder
- the root directory where data & stats files will be saved.fileNamePrefix
- the base file name of data & stats.dataReaderFactory
- the source of the dataset's datapublic static LocalFileDataset createDataset(String rootFolder, String fileNamePrefix, AbstractPipeline pipeline)
rootFolder
directory.
The data & stats files will remain on disk even after the dataset is closed and the JVM exits.rootFolder
- the root directory where data & stats files will be saved.fileNamePrefix
- the base file name of data & stats.pipeline
- the source of the dataset's datapublic static LocalFileDataset openDataset(String rootFolder, String fileNamePrefix)
rootFolder
& fileNamePrefix
.rootFolder
- the root directory where data & stats files are available.fileNamePrefix
- the base file name of data & stats.protected File getDataFile(long fileIndex)
protected File getStatsFile()
protected File getMetadataFile()
public LocalFileDataset setPipeline(AbstractPipeline pipeline)
setPipeline
in class Dataset
public boolean isDeleteFilesOnClose()
public LocalFileDataset setDeleteFilesOnClose(boolean deleteFilesOnClose)
public int getRecordsPerFile()
public LocalFileDataset setRecordsPerFile(int recordsPerFile)
public void close()
public long getRecordCount()
getRecordCount
in class Dataset
public RecordList getRecordList(long offset, int count)
Dataset
getRecordList
in class Dataset
public long getColumnCount()
getColumnCount
in class Dataset
public List<String> getColumnNames()
getColumnNames
in class Dataset
protected Column getOrCreateColumn(String name, int index)
getOrCreateColumn
in class Dataset
public List<Column> getColumns()
getColumns
in class Dataset
protected void beforeLoad()
Dataset
beforeLoad
in class Dataset
protected void afterLoad()
Dataset
protected void afterColumnStatsLoaded()
Dataset
afterColumnStatsLoaded
in class Dataset
protected DataWriter createDataWriter()
Dataset
createDataWriter
in class Dataset
public LocalFileDataset load(Integer maxRecords, JobCallback<DataReader,DataWriter> callback)
Dataset
Dataset.waitForRecordsToLoad()
and Dataset.waitForRecordsToLoad(long, long)
.public DataException addExceptionProperties(DataException exception)
FoundationObject
DataException
. Since this method is called whenever an
exception is thrown, subclasses should override it to add their specific information.addExceptionProperties
in interface DataExceptionContributor
addExceptionProperties
in class FoundationObject
Copyright (c) 2006-2024 North Concepts Inc. All Rights Reserved.