Class HistoryWriter
java.lang.Object
com.inductiveautomation.historian.gateway.query.writing.HistoryWriter
- All Implemented Interfaces:
QueryController
- Direct Known Subclasses:
CalculationHistoryWriter
,TallHistoryWriter
The history writer controls the flow of data from the QueryExecutor to the StreamingDatasetWriter. It also acts as
the query controller, providing access to the query settings.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static interface
protected class
protected class
protected class
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ResultNode
protected List<ResultNode>
protected LoggerEx
protected Object[]
protected QualityCode[]
-
Constructor Summary
ConstructorsConstructorDescriptionHistoryWriter
(String queryId, StreamingDatasetWriter writer, TagHistoryQueryParams params) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
Increments the block end by the block window size.protected void
protected long
protected void
void
execute()
protected void
long
getBlockId
(long time) Returns which block the time belongs to.long
Returns the size of the blocks in milliseconds.protected List<ResultNode>
protected LoggerEx
long
The QueryId is an identifier for this particular query, so we can trace the route of the query across the various parts of SQLTags history.The parameters for the current query.long
protected long
protected void
protected void
Creates the arrays rowData and rowQuality, which will get filled in, and then written from.protected void
protected void
protected void
insertInList
(ResultNode node) protected boolean
protected void
markCompletedTo
(long time) protected void
registerColumn
(ResultNode column) void
setQueryExecutor
(HistoryQueryExecutor executor) void
setWriter
(StreamingDatasetWriter writer)
-
Field Details
-
scSet
-
columns
-
rowData
-
rowQuality
-
colList
-
log
-
-
Constructor Details
-
HistoryWriter
-
-
Method Details
-
calculateMaxRowLimit
protected long calculateMaxRowLimit() -
getLogger
-
getQueryId
The QueryId is an identifier for this particular query, so we can trace the route of the query across the various parts of SQLTags history. Any logging should include this id.- Specified by:
getQueryId
in interfaceQueryController
-
getQueryStart
public long getQueryStart()- Specified by:
getQueryStart
in interfaceQueryController
-
getQueryEnd
public long getQueryEnd()- Specified by:
getQueryEnd
in interfaceQueryController
-
getBlockId
public long getBlockId(long time) Description copied from interface:QueryController
Returns which block the time belongs to. Generally, will be some multiple of the block window on top of the start time. There is one special case that we accommodate: seed values. Those belong to a block BEFORE the start time. For that reason, we calculate everything off of the start time, and not the block end.- Specified by:
getBlockId
in interfaceQueryController
-
setQueryExecutor
-
registerColumn
-
getColumns
-
initLoader
- Throws:
Exception
-
initColumns
Creates the arrays rowData and rowQuality, which will get filled in, and then written from. If a HistoryWriter subclass returns a set of columns that are different than the natural set, this function should be overridden.- Throws:
Exception
-
getRowCount
protected long getRowCount() -
incrementRowCount
protected void incrementRowCount() -
getQueryParameters
Description copied from interface:QueryController
The parameters for the current query.- Specified by:
getQueryParameters
in interfaceQueryController
-
getBlockSize
public long getBlockSize()Description copied from interface:QueryController
Returns the size of the blocks in milliseconds. Will be 0 if the results should be raw data.- Specified by:
getBlockSize
in interfaceQueryController
- Returns:
- time in milliseconds covered by each block.
-
isRawQuery
protected boolean isRawQuery() -
calculateBlockSize
protected void calculateBlockSize() -
setWriter
-
execute
public void execute() -
initializeWriter
protected void initializeWriter() -
finalizeWriter
- Throws:
Exception
-
markCompletedTo
protected void markCompletedTo(long time) -
commitRows
- Throws:
Exception
-
advanceBlockEnd
protected void advanceBlockEnd()Increments the block end by the block window size. -
insertInList
-