@@ -21,7 +21,8 @@ use sqlparser::ast::Statement;
2121use std:: collections:: HashMap ;
2222use std:: fs;
2323use std:: path:: PathBuf ;
24- use std:: sync:: { Arc , Mutex } ;
24+ use std:: sync:: Arc ;
25+ use parking_lot:: Mutex ;
2526
2627use ballista_core:: config:: BallistaConfig ;
2728use ballista_core:: utils:: create_df_ctx_with_ballista_query_planner;
@@ -142,7 +143,7 @@ impl BallistaContext {
142143
143144 // use local DataFusion context for now but later this might call the scheduler
144145 let mut ctx = {
145- let guard = self . state . lock ( ) . unwrap ( ) ;
146+ let guard = self . state . lock ( ) ;
146147 create_df_ctx_with_ballista_query_planner (
147148 & guard. scheduler_host ,
148149 guard. scheduler_port ,
@@ -162,7 +163,7 @@ impl BallistaContext {
162163
163164 // use local DataFusion context for now but later this might call the scheduler
164165 let mut ctx = {
165- let guard = self . state . lock ( ) . unwrap ( ) ;
166+ let guard = self . state . lock ( ) ;
166167 create_df_ctx_with_ballista_query_planner (
167168 & guard. scheduler_host ,
168169 guard. scheduler_port ,
@@ -186,7 +187,7 @@ impl BallistaContext {
186187
187188 // use local DataFusion context for now but later this might call the scheduler
188189 let mut ctx = {
189- let guard = self . state . lock ( ) . unwrap ( ) ;
190+ let guard = self . state . lock ( ) ;
190191 create_df_ctx_with_ballista_query_planner (
191192 & guard. scheduler_host ,
192193 guard. scheduler_port ,
@@ -203,7 +204,7 @@ impl BallistaContext {
203204 name : & str ,
204205 table : Arc < dyn TableProvider > ,
205206 ) -> Result < ( ) > {
206- let mut state = self . state . lock ( ) . unwrap ( ) ;
207+ let mut state = self . state . lock ( ) ;
207208 state. tables . insert ( name. to_owned ( ) , table) ;
208209 Ok ( ( ) )
209210 }
@@ -280,7 +281,7 @@ impl BallistaContext {
280281 /// might require the schema to be inferred.
281282 pub async fn sql ( & self , sql : & str ) -> Result < Arc < dyn DataFrame > > {
282283 let mut ctx = {
283- let state = self . state . lock ( ) . unwrap ( ) ;
284+ let state = self . state . lock ( ) ;
284285 create_df_ctx_with_ballista_query_planner (
285286 & state. scheduler_host ,
286287 state. scheduler_port ,
@@ -291,7 +292,7 @@ impl BallistaContext {
291292 let is_show = self . is_show_statement ( sql) . await ?;
292293 // the show tables、 show columns sql can not run at scheduler because the tables is store at client
293294 if is_show {
294- let state = self . state . lock ( ) . unwrap ( ) ;
295+ let state = self . state . lock ( ) ;
295296 ctx = ExecutionContext :: with_config (
296297 ExecutionConfig :: new ( ) . with_information_schema (
297298 state. config . default_with_information_schema ( ) ,
@@ -301,7 +302,7 @@ impl BallistaContext {
301302
302303 // register tables with DataFusion context
303304 {
304- let state = self . state . lock ( ) . unwrap ( ) ;
305+ let state = self . state . lock ( ) ;
305306 for ( name, prov) in & state. tables {
306307 ctx. register_table (
307308 TableReference :: Bare { table : name } ,
@@ -483,7 +484,7 @@ mod tests {
483484 . unwrap ( ) ;
484485
485486 {
486- let mut guard = context. state . lock ( ) . unwrap ( ) ;
487+ let mut guard = context. state . lock ( ) ;
487488 let csv_table = guard. tables . get ( "single_nan" ) ;
488489
489490 if let Some ( table_provide) = csv_table {
0 commit comments