Class HistorianPointQueryExecutor<P extends DataPoint<?>,K extends DataPointQueryKey>
java.lang.Object
com.inductiveautomation.historian.gateway.interop.HistorianPointQueryExecutor<P,K>
- All Implemented Interfaces:
QueriedPointProcessor<P,
,K, DataPointType> HistoryQueryExecutor
- Direct Known Subclasses:
HistorianAggregatedQueryExecutor
,HistorianRawQueryExecutor
public abstract class HistorianPointQueryExecutor<P extends DataPoint<?>,K extends DataPointQueryKey>
extends Object
implements HistoryQueryExecutor, QueriedPointProcessor<P,K,DataPointType>
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final com.google.common.collect.Multimap<K,
HistorianDataColumn<K>> protected final List<HistorianDataColumn<K>>
protected final QueryController
protected static final LoggerEx
protected final QueryEngine
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
HistorianPointQueryExecutor
(QueryEngine queryEngine, Collection<HistorianDataColumn<K>> columns, QueryController controller) -
Method Summary
Modifier and TypeMethodDescriptionvoid
If startReading was called, this function must be called (that is, it should be in a finally block).protected abstract void
List<? extends ResultNode>
Returns the HistoryNodes of this executor.boolean
hasMore()
Returns TRUE if there is more data available to be written on call to processData()void
Initializes the query, performing any actions necessary to get the information required to run the query.protected boolean
protected boolean
isOperationTimedOut
(long startMS) long
nextTime()
The timestamp of the next value.protected void
void
Called when all processing is complete.void
onError
(QualityCode error) Handles a terminal error condition with a quality code.void
Handles a terminal error condition with an exception.boolean
onInitialize
(ProcessingContext<K, DataPointType> context) Initializes the processor with context information before processing begins.void
onKeyFailure
(K queryKey, QualityCode failureCode) Handles a failure specific to a query key.boolean
onPointAvailable
(K queryKey, P point) Processes a single temporal point.long
Puts the next value(s) into the appropriate column, returning the latest timestamp loaded, or -1 if no data was loaded.void
Begins reading data.protected void
protected void
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.inductiveautomation.ignition.gateway.sqltags.history.query.HistoryQueryExecutor
getEffectiveWindowSizeMS
-
Field Details
-
log
-
columnMap
protected final com.google.common.collect.Multimap<K extends DataPointQueryKey,HistorianDataColumn<K extends DataPointQueryKey>> columnMap -
columns
-
queryEngine
-
controller
-
-
Constructor Details
-
HistorianPointQueryExecutor
protected HistorianPointQueryExecutor(QueryEngine queryEngine, Collection<HistorianDataColumn<K>> columns, QueryController controller)
-
-
Method Details
-
initialize
public void initialize()Description copied from interface:HistoryQueryExecutor
Initializes the query, performing any actions necessary to get the information required to run the query.- Specified by:
initialize
in interfaceHistoryQueryExecutor
-
getColumnNodes
Description copied from interface:HistoryQueryExecutor
Returns the HistoryNodes of this executor. There MUST be one for every tag path, and they must be in the same order as the paths provided to the executor when it was created. Also, these values must be available as soon as the executor is created. However, they won't be consulted for their data type until after initialize is called, so the normal procedure is to create and returnDelegatingResultNode
s, which get filled in later.- Specified by:
getColumnNodes
in interfaceHistoryQueryExecutor
-
startReading
public void startReading()Description copied from interface:HistoryQueryExecutor
Begins reading data. IMPORTANT: endReading should always be called at some point after calling startReading.- Specified by:
startReading
in interfaceHistoryQueryExecutor
-
waitForColumnInit
protected void waitForColumnInit() -
endReading
public void endReading()Description copied from interface:HistoryQueryExecutor
If startReading was called, this function must be called (that is, it should be in a finally block).- Specified by:
endReading
in interfaceHistoryQueryExecutor
-
isOperationTimedOut
protected boolean isOperationTimedOut(long startMS) -
waitForData
protected void waitForData() -
isFinished
protected boolean isFinished() -
hasMore
public boolean hasMore()Description copied from interface:HistoryQueryExecutor
Returns TRUE if there is more data available to be written on call to processData()- Specified by:
hasMore
in interfaceHistoryQueryExecutor
-
nextTime
public long nextTime()Description copied from interface:HistoryQueryExecutor
The timestamp of the next value. -1 if no value is available.- Specified by:
nextTime
in interfaceHistoryQueryExecutor
-
processData
public long processData()Description copied from interface:HistoryQueryExecutor
Puts the next value(s) into the appropriate column, returning the latest timestamp loaded, or -1 if no data was loaded.- Specified by:
processData
in interfaceHistoryQueryExecutor
-
onInitialize
Description copied from interface:QueriedPointProcessor
Initializes the processor with context information before processing begins. This method is called once before any points are processed.- Specified by:
onInitialize
in interfaceQueriedPointProcessor<P extends DataPoint<?>,
K extends DataPointQueryKey, DataPointType> - Parameters:
context
- The processing context containing initialization properties.- Returns:
- True if initialization was successful and processing should continue, false to stop.
-
onPointAvailable
Description copied from interface:QueriedPointProcessor
Processes a single temporal point. Called repeatedly for each point in the result set.- Specified by:
onPointAvailable
in interfaceQueriedPointProcessor<P extends DataPoint<?>,
K extends DataPointQueryKey, DataPointType> - Parameters:
queryKey
- The query key associated with the point.point
- The temporal point to process.- Returns:
- True to continue processing additional points, false to stop.
-
onKeyFailure
Description copied from interface:QueriedPointProcessor
Handles a failure specific to a query key. Processing continues for other query keys after this is called. This method can be called prior toQueriedPointProcessor.onInitialize(ProcessingContext)
as needed.- Specified by:
onKeyFailure
in interfaceQueriedPointProcessor<P extends DataPoint<?>,
K extends DataPointQueryKey, DataPointType> - Parameters:
queryKey
- The query key that failed.failureCode
- The quality code indicating the reason for failure.
-
onError
Description copied from interface:QueriedPointProcessor
Handles a terminal error condition with a quality code. Processing stops after this method is called.- Specified by:
onError
in interfaceQueriedPointProcessor<P extends DataPoint<?>,
K extends DataPointQueryKey, DataPointType> - Parameters:
error
- The quality code representing the error condition.
-
onError
Description copied from interface:QueriedPointProcessor
Handles a terminal error condition with an exception. Processing stops after this method is called.- Specified by:
onError
in interfaceQueriedPointProcessor<P extends DataPoint<?>,
K extends DataPointQueryKey, DataPointType> - Parameters:
error
- The exception that caused the error.
-
onComplete
public void onComplete()Description copied from interface:QueriedPointProcessor
Called when all processing is complete. This method is called exactly once after all points have been processed or processing has been stopped.- Specified by:
onComplete
in interfaceQueriedPointProcessor<P extends DataPoint<?>,
K extends DataPointQueryKey, DataPointType>
-
notifyValueBuffer
protected void notifyValueBuffer() -
executeQuery
protected abstract void executeQuery()
-