File tree Expand file tree Collapse file tree 1 file changed +13
-4
lines changed
Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -825,10 +825,19 @@ impl PySessionContext {
825825 }
826826
827827 pub fn table ( & self , name : & str , py : Python ) -> PyResult < PyDataFrame > {
828- let x = wait_for_future ( py, self . ctx . table ( name) )
829- . map_err ( |e| PyKeyError :: new_err ( e. to_string ( ) ) ) ?
830- . map_err ( py_datafusion_err) ?;
831- Ok ( PyDataFrame :: new ( x) )
828+ let res = wait_for_future ( py, self . ctx . table ( name) )
829+ . map_err ( |e| PyKeyError :: new_err ( e. to_string ( ) ) ) ?;
830+ match res {
831+ Ok ( df) => Ok ( PyDataFrame :: new ( df) ) ,
832+ Err ( e) => {
833+ if let datafusion:: error:: DataFusionError :: Plan ( msg) = & e {
834+ if msg. contains ( "No table named" ) {
835+ return Err ( PyKeyError :: new_err ( msg. to_string ( ) ) ) ;
836+ }
837+ }
838+ Err ( py_datafusion_err ( e) )
839+ }
840+ }
832841 }
833842
834843 pub fn table_exist ( & self , name : & str ) -> PyDataFusionResult < bool > {
You can’t perform that action at this time.
0 commit comments