Package com.facebook.presto.jdbc
Interface QueryInterceptor
public interface QueryInterceptor
-
Method Summary
Modifier and TypeMethodDescriptiondefault voiddestroy()Called once to release any resources whenPrestoConnectionis closing.default voidCalled once perPrestoConnectionat instantiation.default Optional<PrestoResultSet>postProcess(String sql, Statement interceptedStatement, PrestoResultSet interceptedResultSet) Called after the query has been sent to the server.default Optional<PrestoResultSet>preProcess(String sql, Statement interceptedStatement) Called before the query has been sent to the server.
-
Method Details
-
init
Called once perPrestoConnectionat instantiation.- Parameters:
properties- the session properties supplied in the URI
-
destroy
default void destroy()Called once to release any resources whenPrestoConnectionis closing. -
preProcess
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 aQueryInterceptoris not intercepted. This method can optionally return aPrestoResultSet. If aPrestoResultSetis returned from frompreProcessthen the intercepted query is not executed and thatPrestoResultSetis returned instead. If there are multipleQueryInterceptors,preProcesswill be called on each and the lastPrestoResultSetis returned.- Parameters:
sql- the SQL string of the query.interceptedStatement- the Statement being executed.- Returns:
- optional
PrestoResultSetto 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 aQueryInterceptoris not intercepted. This method can optionally return aPrestoResultSet. If aPrestoResultSetis returned from postProcess then thatPrestoResultSetis returned instead. If there are multipleQueryInterceptors,postProcesswill be called on each and the lastPrestoResultSetis returned.- Parameters:
sql- the SQL string of the query.interceptedStatement- theStatementbeing executed.interceptedResultSet- the interceptedPrestoResultSet- Returns:
- optional
PrestoResultSetto be returned instead of the originalPrestoResultSet
-