11use super :: snowflake_error:: SnowflakeError ;
2- use crate :: query_types:: { QueryRecordId , QueryStatus } ;
2+ use crate :: query_types:: { QueryId , QueryStatus } ;
33use catalog:: error:: Error as CatalogError ;
44use datafusion_common:: DataFusionError ;
55use error_stack_trace;
@@ -544,18 +544,18 @@ pub enum Error {
544544 location : Location ,
545545 } ,
546546
547- #[ snafu( display( "{}: Query execution error: {source}" , query_id . as_uuid ( ) ) ) ]
547+ #[ snafu( display( "{query_id }: Query execution error: {source}" ) ) ]
548548 QueryExecution {
549- query_id : QueryRecordId ,
549+ query_id : QueryId ,
550550 #[ snafu( source( from( Error , Box :: new) ) ) ]
551551 source : Box < Error > ,
552552 #[ snafu( implicit) ]
553553 location : Location ,
554554 } ,
555555
556- #[ snafu( display( "Query {} isn't running" , query_id . as_uuid ( ) ) ) ]
556+ #[ snafu( display( "Query {query_id } isn't running" ) ) ]
557557 QueryIsntRunning {
558- query_id : QueryRecordId ,
558+ query_id : QueryId ,
559559 #[ snafu( implicit) ]
560560 location : Location ,
561561 } ,
@@ -568,48 +568,32 @@ pub enum Error {
568568 } ,
569569
570570 // When user tried to get result before query finished
571- #[ snafu( display( "Query {} is running" , query_id . as_uuid ( ) ) ) ]
571+ #[ snafu( display( "Query {query_id } is running" ) ) ]
572572 QueryIsRunning {
573- query_id : QueryRecordId ,
573+ query_id : QueryId ,
574574 #[ snafu( implicit) ]
575575 location : Location ,
576576 } ,
577577
578- #[ snafu( display( "Query {} cancelled" , query_id . as_uuid ( ) ) ) ]
578+ #[ snafu( display( "Query {query_id } cancelled" ) ) ]
579579 QueryCancelled {
580- query_id : QueryRecordId ,
580+ query_id : QueryId ,
581581 #[ snafu( implicit) ]
582582 location : Location ,
583583 } ,
584584
585- #[ snafu( display( "Query [{}] result sending error" , query_id. as_uuid( ) ) ) ]
586- QueryResultSend {
587- query_id : QueryRecordId ,
588- #[ snafu( implicit) ]
589- location : Location ,
590- } ,
591-
592- #[ snafu( display( "Query [{}] result recv error: {error}" , query_id. as_uuid( ) ) ) ]
593- QueryResultRecv {
594- query_id : QueryRecordId ,
595- #[ snafu( source) ]
596- error : tokio:: sync:: oneshot:: error:: RecvError ,
597- #[ snafu( implicit) ]
598- location : Location ,
599- } ,
600-
601- #[ snafu( display( "Query [{}] result notify error: {error}" , query_id. as_uuid( ) ) ) ]
585+ #[ snafu( display( "Query {query_id} result notify error: {error}" ) ) ]
602586 QueryStatusRecv {
603- query_id : QueryRecordId ,
587+ query_id : QueryId ,
604588 #[ snafu( source) ]
605589 error : tokio:: sync:: watch:: error:: RecvError ,
606590 #[ snafu( implicit) ]
607591 location : Location ,
608592 } ,
609593
610- #[ snafu( display( "Query [{}] status notify error: {error}" , query_id . as_uuid ( ) ) ) ]
594+ #[ snafu( display( "Query {query_id} status notify error: {error}" ) ) ]
611595 NotifyQueryStatus {
612- query_id : QueryRecordId ,
596+ query_id : QueryId ,
613597 #[ snafu( source) ]
614598 error : tokio:: sync:: watch:: error:: SendError < QueryStatus > ,
615599 #[ snafu( implicit) ]
@@ -624,14 +608,38 @@ pub enum Error {
624608 #[ snafu( implicit) ]
625609 location : Location ,
626610 } ,
611+
612+ #[ snafu( display( "Failed to get async result for query [{query_id}]: {error}" ) ) ]
613+ AsyncResultTaskJoin {
614+ #[ snafu( source) ]
615+ error : tokio:: task:: JoinError ,
616+ query_id : QueryId ,
617+ #[ snafu( implicit) ]
618+ location : Location ,
619+ } ,
620+
621+ #[ snafu( display( "Failed to join query subtask: {error}" ) ) ]
622+ QuerySubtaskJoin {
623+ #[ snafu( source) ]
624+ error : tokio:: task:: JoinError ,
625+ #[ snafu( implicit) ]
626+ location : Location ,
627+ } ,
628+
629+ #[ snafu( display( "Missing results handle in running query [{query_id:?}]" ) ) ]
630+ NoJoinHandle {
631+ query_id : QueryId ,
632+ #[ snafu( implicit) ]
633+ location : Location ,
634+ } ,
627635}
628636
629637impl Error {
630- pub fn query_id ( & self ) -> QueryRecordId {
638+ pub fn query_id ( & self ) -> QueryId {
631639 if let Self :: QueryExecution { query_id, .. } = self {
632640 * query_id
633641 } else {
634- QueryRecordId :: default ( )
642+ QueryId :: default ( )
635643 }
636644 }
637645 #[ must_use]
0 commit comments