public class DatasourceQueryExecutor extends AbstractHistoryLoader<java.lang.Integer>
Modifier and Type | Class and Description |
---|---|
protected static class |
DatasourceQueryExecutor.MixedModeInterpolator |
protected static class |
DatasourceQueryExecutor.PreprocessedHistoryGroup
We implement our own history group here in hopes of being as efficient as possible.
|
endTime, startTime
Constructor and Description |
---|
DatasourceQueryExecutor(GatewayContext context,
QueryController controller,
java.util.List<ColumnQueryDefinition> colDefs,
java.lang.String datasource,
java.lang.String gatewayName,
java.lang.String providerName) |
Modifier and Type | Method and Description |
---|---|
protected boolean |
advancePartition()
Queries data and sets up valueRS.
|
protected void |
buildColumns() |
protected Interpolator |
createInterpolator(DataTypeClass dataType,
TimelineList<InterpolationMode> timelineList) |
void |
endReading()
If startReading was called, this function must be called (that is, it should be in a finally
block).
|
protected HistoryColumn |
getColumnAt(int pos)
Returns HistoryColumn, or null if the node isn't a column, which shouldn't happen after 7.8.2.
|
java.util.List<? extends HistoryNode> |
getColumnNodes()
Returns the HistoryNodes of this executor.
|
protected java.util.Collection<HistoryNode> |
getColumns(java.lang.String path) |
protected DataTypeClass |
getDataTypeFor(java.lang.String name,
HistoricalInfoMap.HistoricalInfo info) |
protected DataTypeClass |
getDataTypeForTag(java.lang.Integer tagId) |
protected DataTypeClass |
getDataTypeForTagColumn(java.lang.Integer tagId) |
int |
getEffectiveWindowSizeMS()
When "natural" results are requested, this will be called to let the query executors say what they think
"natural" means.
|
protected java.util.Set<java.lang.Integer> |
getIdsForPostQuery(long end) |
protected java.util.Set<java.lang.Integer> |
getIdsForTime(long start,
long end,
boolean compressedOnly)
Returns the tag ids that were in use during the span of time (inclusive).
|
protected LoggerEx |
getLogger() |
protected HistoryNode |
getNodeAt(int pos) |
protected java.util.Collection<java.lang.Integer> |
getPathPositions(java.lang.String path)
Returns the positions of columns for the given path.
|
protected HistoricalValue |
getPotentiallyStaleDatapoint(long valueTS)
Returns a stale datapoint for the appropriate time if the system was down sometime between the last value to now.
|
protected QueryCache |
getQueryCache() |
protected java.lang.String |
getReadQuery(int tagids,
java.lang.String partitionName,
boolean includeVType)
Returns a read query for the specified number of tag id parameters.
|
protected com.google.common.collect.Multimap<java.lang.String,java.lang.Integer> |
getSeedIdMap(boolean post) |
protected RawTagValue |
getValueFromDS(Dataset ds,
int rowId) |
protected RawTagValue |
getValueFromRS(java.sql.ResultSet rs) |
void |
initialize()
The primary task of initialize is to load the information about the tags and update the columns, so that we'll be
ready to query.
|
protected long |
loadValue(IdentifiedHistoricalValue<java.lang.Integer> value)
Puts the value into the appropriate column.
|
protected void |
maybeSortTagInfo() |
protected void |
primeRead()
This function starts the read process, and gets the system ready for the first call to readNextFromSource
|
protected java.util.SortedSet<RawTagValue> |
readCompletionValues() |
protected IdentifiedHistoricalValue<java.lang.Integer> |
readNextFromSource() |
protected IdentifiedHistoricalValue<java.lang.Integer> |
readPreProcessedSet()
This function reads a set of processed values.
|
protected java.util.SortedSet<RawTagValue> |
readSeedValues()
This function reads the "seed" values- the last value for each tag before the start time.
|
protected IdentifiedHistoricalValue<java.lang.Integer> |
readSingle() |
protected java.util.SortedSet<RawTagValue> |
runSpecialValueQuery(java.lang.String query,
java.lang.Long timeParam,
java.util.List<Partition> partitions,
com.google.common.collect.Multimap<java.lang.String,java.lang.Integer> toReadSet) |
protected IdentifiedHistoricalValue<java.lang.Integer> |
updatePreProcSet(IdentifiedHistoricalValue<java.lang.Integer> curVal,
IdentifiedHistoricalValue<java.lang.Integer> newVal) |
protected boolean |
usingPreProcessed() |
getController, getEndTime, getQueryId, getSeedValues, getStartTime, hasMore, nextTime, pathToString, processData, readNext, setErrored, setPostValues, setSeedValues, startReading
public DatasourceQueryExecutor(@Nonnull GatewayContext context, @Nonnull QueryController controller, @Nonnull java.util.List<ColumnQueryDefinition> colDefs, java.lang.String datasource, @Nullable java.lang.String gatewayName, java.lang.String providerName)
protected LoggerEx getLogger()
getLogger
in class AbstractHistoryLoader<java.lang.Integer>
protected QueryCache getQueryCache()
protected java.lang.String getReadQuery(int tagids, java.lang.String partitionName, boolean includeVType)
tagids
- public java.util.List<? extends HistoryNode> getColumnNodes()
HistoryQueryExecutor
DelegatingHistoryNode
s, which get filled in later.protected java.util.Collection<java.lang.Integer> getPathPositions(java.lang.String path)
path
- protected java.util.Collection<HistoryNode> getColumns(java.lang.String path)
protected DataTypeClass getDataTypeFor(java.lang.String name, HistoricalInfoMap.HistoricalInfo info)
protected void buildColumns()
protected HistoryNode getNodeAt(int pos)
protected HistoryColumn getColumnAt(int pos)
protected Interpolator createInterpolator(DataTypeClass dataType, TimelineList<InterpolationMode> timelineList)
public int getEffectiveWindowSizeMS()
HistoryQueryExecutor
protected com.google.common.collect.Multimap<java.lang.String,java.lang.Integer> getSeedIdMap(boolean post)
protected DataTypeClass getDataTypeForTag(java.lang.Integer tagId)
protected DataTypeClass getDataTypeForTagColumn(java.lang.Integer tagId)
protected void maybeSortTagInfo()
protected java.util.Set<java.lang.Integer> getIdsForTime(long start, long end, boolean compressedOnly)
start
- end
- protected java.util.Set<java.lang.Integer> getIdsForPostQuery(long end)
protected HistoricalValue getPotentiallyStaleDatapoint(long valueTS)
protected long loadValue(IdentifiedHistoricalValue<java.lang.Integer> value)
AbstractHistoryLoader
loadValue
in class AbstractHistoryLoader<java.lang.Integer>
public void initialize() throws java.lang.Exception
initialize
in interface HistoryQueryExecutor
initialize
in class AbstractHistoryLoader<java.lang.Integer>
java.lang.Exception
protected RawTagValue getValueFromRS(java.sql.ResultSet rs) throws java.lang.Exception
java.lang.Exception
protected RawTagValue getValueFromDS(Dataset ds, int rowId) throws java.lang.Exception
java.lang.Exception
protected java.util.SortedSet<RawTagValue> readSeedValues() throws java.lang.Exception
java.lang.Exception
protected java.util.SortedSet<RawTagValue> readCompletionValues() throws java.lang.Exception
java.lang.Exception
protected java.util.SortedSet<RawTagValue> runSpecialValueQuery(java.lang.String query, java.lang.Long timeParam, java.util.List<Partition> partitions, com.google.common.collect.Multimap<java.lang.String,java.lang.Integer> toReadSet) throws java.lang.Exception
java.lang.Exception
protected void primeRead() throws java.lang.Exception
AbstractHistoryLoader
primeRead
in class AbstractHistoryLoader<java.lang.Integer>
java.lang.Exception
public void endReading()
HistoryQueryExecutor
endReading
in interface HistoryQueryExecutor
endReading
in class AbstractHistoryLoader<java.lang.Integer>
protected boolean advancePartition() throws java.lang.Exception
java.lang.Exception
protected IdentifiedHistoricalValue<java.lang.Integer> readNextFromSource() throws java.lang.Exception
readNextFromSource
in class AbstractHistoryLoader<java.lang.Integer>
java.lang.Exception
protected boolean usingPreProcessed()
protected IdentifiedHistoricalValue<java.lang.Integer> readPreProcessedSet() throws java.lang.Exception
java.lang.Exception
protected IdentifiedHistoricalValue<java.lang.Integer> updatePreProcSet(IdentifiedHistoricalValue<java.lang.Integer> curVal, IdentifiedHistoricalValue<java.lang.Integer> newVal)
protected IdentifiedHistoricalValue<java.lang.Integer> readSingle() throws java.lang.Exception
java.lang.Exception