File tree Expand file tree Collapse file tree 2 files changed +9
-2
lines changed
Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -1086,8 +1086,10 @@ impl PySessionContext {
10861086 self . ctx . remove_optimizer_rule ( name)
10871087 }
10881088
1089- pub fn table_provider ( & self , name : & str , py : Python ) -> PyDataFusionResult < PyTable > {
1090- let provider = wait_for_future ( py, self . ctx . table_provider ( name) ) ??;
1089+ pub fn table_provider ( & self , name : & str , py : Python ) -> PyResult < PyTable > {
1090+ let provider = wait_for_future ( py, self . ctx . table_provider ( name) )
1091+ . map_err ( |e| PyKeyError :: new_err ( e. to_string ( ) ) ) ?
1092+ . map_err ( |e| PyKeyError :: new_err ( e. to_string ( ) ) ) ?;
10911093 Ok ( PyTable { table : provider } )
10921094 }
10931095
Original file line number Diff line number Diff line change @@ -593,6 +593,11 @@ def test_table_provider(ctx):
593593 assert tbl .schema == pa .schema ([("x" , pa .int64 ())])
594594
595595
596+ def test_table_provider_not_found (ctx ):
597+ with pytest .raises (KeyError ):
598+ ctx .table_provider ("nonexistent_table" )
599+
600+
596601def test_read_json (ctx ):
597602 path = pathlib .Path (__file__ ).parent .resolve ()
598603
You can’t perform that action at this time.
0 commit comments