File tree Expand file tree Collapse file tree 1 file changed +18
-1
lines changed
Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change 2020import pyarrow as pa
2121import pyarrow .dataset as ds
2222import pytest
23- from datafusion import SessionContext , Table
23+ from datafusion import SessionContext , Table , udtf
2424
2525
2626# Note we take in `database` as a variable even though we don't use
@@ -232,3 +232,20 @@ def test_in_end_to_end_python_providers(ctx: SessionContext):
232232 assert len (batches ) == 1
233233 assert batches [0 ].column (0 ) == pa .array ([1 , 2 , 3 ])
234234 assert batches [0 ].column (1 ) == pa .array ([4 , 5 , 6 ])
235+
236+
237+ def test_python_udtf_missing_table_capsule (ctx : SessionContext ) -> None :
238+ @udtf ("missing_capsule" )
239+ def missing_capsule_udtf () -> Table :
240+ return Table (ctx .sql ("SELECT 1 AS value" ))
241+
242+ ctx .register_udtf (missing_capsule_udtf )
243+
244+ with pytest .raises (NotImplementedError , match = "__datafusion_table_provider__" ):
245+ ctx .sql ("SELECT * FROM missing_capsule()" ).collect ()
246+
247+
248+ def test_table_wrapper_lacks_capsule_attribute (ctx : SessionContext ) -> None :
249+ table = Table (ctx .sql ("SELECT 1 AS value" ))
250+
251+ assert not hasattr (table , "__datafusion_table_provider__" )
You can’t perform that action at this time.
0 commit comments