@@ -27,14 +27,15 @@ use tokio::sync::Mutex;
2727use crate :: auth:: AuthManager ;
2828use arrow_pg:: datatypes:: df;
2929use arrow_pg:: datatypes:: { arrow_schema_to_pg_fields, into_pg_type} ;
30+ use datafusion:: sql:: sqlparser;
3031use datafusion_pg_catalog:: pg_catalog:: context:: { Permission , ResourceType } ;
3132use datafusion_pg_catalog:: sql:: PostgresCompatibilityParser ;
3233
3334#[ async_trait]
3435pub trait QueryHook : Send + Sync {
3536 async fn handle_query (
3637 & self ,
37- statement : & Statement ,
38+ statement : & sqlparser :: ast :: Statement ,
3839 session_context : & SessionContext ,
3940 client : & dyn ClientInfo ,
4041 ) -> Option < PgWireResult < Vec < Response > > > ;
@@ -490,9 +491,8 @@ impl SimpleQueryHandler for DfSessionService {
490491
491492 // Call query hooks with the parsed statement
492493 for hook in & self . query_hooks {
493- let wrapped_statement = Statement :: Statement ( Box :: new ( statement. clone ( ) ) ) ;
494494 if let Some ( result) = hook
495- . handle_query ( & wrapped_statement , & self . session_context , client)
495+ . handle_query ( & statement , & self . session_context , client)
496496 . await
497497 {
498498 return result;
@@ -652,9 +652,8 @@ impl ExtendedQueryHandler for DfSessionService {
652652 . map_err ( |e| PgWireError :: ApiError ( Box :: new ( e) ) ) ?;
653653
654654 if let Some ( statement) = statements. into_iter ( ) . next ( ) {
655- let wrapped_statement = Statement :: Statement ( Box :: new ( statement) ) ;
656655 if let Some ( result) = hook
657- . handle_query ( & wrapped_statement , & self . session_context , client)
656+ . handle_query ( & statement , & self . session_context , client)
658657 . await
659658 {
660659 // Convert Vec<Response> to single Response
0 commit comments