Interface QueryInterceptor


public interface QueryInterceptor
  • Method Details

    • init

      default void init(Map<String,String> properties)
      Called once per PrestoConnection at instantiation.
      Parameters:
      properties - the session properties supplied in the URI
    • destroy

      default void destroy()
      Called once to release any resources when PrestoConnection is closing.
    • preProcess

      default Optional<PrestoResultSet> preProcess(String sql, Statement interceptedStatement)
      Called before the query has been sent to the server. This method is only called on top-level queries i.e. a query executed by a QueryInterceptor is not intercepted. This method can optionally return a PrestoResultSet. If a PrestoResultSet is returned from from preProcess then the intercepted query is not executed and that PrestoResultSet is returned instead. If there are multiple QueryInterceptors, preProcess will be called on each and the last PrestoResultSet is returned.
      Parameters:
      sql - the SQL string of the query.
      interceptedStatement - the Statement being executed.
      Returns:
      optional PrestoResultSet to be returned
    • postProcess

      default Optional<PrestoResultSet> postProcess(String sql, Statement interceptedStatement, PrestoResultSet interceptedResultSet)
      Called after the query has been sent to the server. This method is only called on top-level queries i.e. a query executed by a QueryInterceptor is not intercepted. This method can optionally return a PrestoResultSet. If a PrestoResultSet is returned from postProcess then that PrestoResultSet is returned instead. If there are multiple QueryInterceptors, postProcess will be called on each and the last PrestoResultSet is returned.
      Parameters:
      sql - the SQL string of the query.
      interceptedStatement - the Statement being executed.
      interceptedResultSet - the intercepted PrestoResultSet
      Returns:
      optional PrestoResultSet to be returned instead of the original PrestoResultSet