2 Replies Latest reply on Jul 9, 2012 2:50 PM by Andriy Rokhmanov

    Statement Warnings and Continuous Execution

    Andriy Rokhmanov Newbie

      Hi,

       

      Teiid allows to use Statement SQLWarnings as a notification mechanism between translators and client code. Per Statement.getWarnings() definition, "the warning chain is automatically cleared each time a statement is (re)executed". Looks like in case of Continuous execution, the StatementImpl.serverWarnings collection gets additional warnings element when the translator adds warning by executionContext.addWarning(). I haven't tried to run continuous query for the long time, but I believe I can reach OOM if translator will add only one warning during every re-execution.

       

      We use SQLWarnings as a notification mechanism during continuous execution that resultset is completely delivered to client and statement is about to be re-executed. The StatementCallback does not have onResultset() method, only onRow(). Is it possible to clean-up warnings on getWarning() method in Statement somehow, or use another approach to notify client?

        • 1. Re: Statement Warnings and Continuous Execution
          Steven Hawkins Master

          Andriy,

           

          Statement warnings do clear for each execution of a statement, however from a client prespective a continuous execution is a single statement execution.  Even in the normal query execution case it is possible to accumulate too many warnings on the client, as we don't yet have code to bound the accumulated statement warnings.   

           

          In general the style of the continuous execution is entirely up to the query and the sources.  If you have a query that doesn't specify any post-processing operations over the entire result (no sort/grouping/etc.) and the translator never indicates an end of results, then only a single iteration of the plan will be executed.  More typically the sources will only answer for results over an interval and the plan will be reexecuted on the server side many times.  onResultSet only makes sense in the latter case, but can be easily added.

           

          Statement warnings can be cleared with the clearWarnings method.  It could also make sense though to add warning handling on the callback rather than accumulating on the statement.

           

          Steve

          • 2. Re: Statement Warnings and Continuous Execution
            Andriy Rokhmanov Newbie

            Steven, I ended wiping out the warnings from statement between re-executions using clearWarnings method. I'll probably get back to this later with more thoughts, but for now I am fine, thanks!