Interface HistoryQueryExecutor

  • All Known Implementing Classes:
    AbstractHistoryLoader, AggregateHistoryQueryExecutor, DatasourceQueryExecutor, ErroredQueryExecutor, HistorianQueryExecutor, LegacyHistoryExecutor, RemoteTagHistoryQueryExecutor

    public interface HistoryQueryExecutor
    This is a running query executed by a tag history provider. It will be created by the history provider, and use by the query manager. In general, the execution will go from top to bottom:
    1. initialize() - The query will load information needed for the query. After this call, it is expected that the column nodes will be filled in with their correct data types, or error qualities if bad.
    2. startReading() - The query process will start
    3. While hasMore() : processData()
    4. endReading()

    The processData call is allowed to process as much as it wants, but the idea is that it should only process the minimum necessary, to minimize the memory overhead of the query. After each process, the query executor will examine the columns for processed values, and write a result row to the streaming dataset, if possible.

    When no more data is available (or the query is canceled), endReading will be called to clean up resources.

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void endReading()
      If startReading was called, this function must be called (that is, it should be in a finally block).
      java.util.List<? extends HistoryNode> getColumnNodes()
      Returns the HistoryNodes of this executor.
      int getEffectiveWindowSizeMS()
      When "natural" results are requested, this will be called to let the query executors say what they think "natural" means.
      boolean hasMore()
      Returns TRUE if there is more data available to be written on call to processData()
      void initialize()
      Initializes the query, performing any actions necessary to get the information required to run the query.
      long nextTime()
      The timestamp of the next value.
      long processData()
      Puts the next value(s) into the appropriate column, returning the latest timestamp loaded, or -1 if no data was loaded.
      void startReading()
      Begins reading data.
    • Method Detail

      • initialize

        void initialize()
                 throws java.lang.Exception
        Initializes the query, performing any actions necessary to get the information required to run the query.
        Throws:
        java.lang.Exception
      • getColumnNodes

        java.util.List<? extends HistoryNode> getColumnNodes()
        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 return DelegatingHistoryNodes, which get filled in later.
      • getEffectiveWindowSizeMS

        int getEffectiveWindowSizeMS()
        When "natural" results are requested, this will be called to let the query executors say what they think "natural" means. If a query executor does not support natural results, it should return -1. If all of the query executors return -1, a raw query will be performed.
      • startReading

        void startReading()
                   throws java.lang.Exception
        Begins reading data. IMPORTANT: endReading should always be called at some point after calling startReading.
        Throws:
        java.lang.Exception
      • endReading

        void endReading()
        If startReading was called, this function must be called (that is, it should be in a finally block).
      • hasMore

        boolean hasMore()
        Returns TRUE if there is more data available to be written on call to processData()
      • nextTime

        long nextTime()
        The timestamp of the next value. -1 if no value is available.
      • processData

        long processData()
                  throws java.lang.Exception
        Puts the next value(s) into the appropriate column, returning the latest timestamp loaded, or -1 if no data was loaded.
        Throws:
        java.lang.Exception