File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed
Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -10,19 +10,23 @@ def main() -> None:
1010 """Demonstrate current failure modes around table provider capsules."""
1111
1212 ctx = SessionContext ()
13+ capsule_source = Table (ctx .sql ("SELECT 1 AS value" ))
1314
1415 @udtf ("table_from_sql" )
1516 def table_from_sql_udtf () -> Table :
1617 """Return a DataFusion Table constructed from a SQL query."""
1718
18- return Table ( ctx . sql ( "SELECT 1 AS value" ))
19+ return capsule_source
1920
2021 ctx .register_udtf (table_from_sql_udtf )
2122
2223 try :
23- ctx .sql ("SELECT * FROM table( table_from_sql() )" ).collect ()
24+ ctx .sql ("SELECT * FROM table_from_sql()" ).collect ()
2425 except NotImplementedError as err :
25- print ("Collecting from table_from_sql() failed:" , err )
26+ print (
27+ "Collecting from table_from_sql() failed because the table provider capsule is missing:" ,
28+ err ,
29+ )
2630
2731 ctx .register_table ("numbers" , Table (ctx .sql ("SELECT 1 AS value" )))
2832
@@ -31,7 +35,10 @@ def table_from_sql_udtf() -> Table:
3135 try :
3236 getattr (numbers , "__datafusion_table_provider__" )
3337 except AttributeError as err :
34- print ("Accessing __datafusion_table_provider__ on catalog table failed:" , err )
38+ print (
39+ "Accessing __datafusion_table_provider__ on catalog table failed because the capsule attribute is missing:" ,
40+ err ,
41+ )
3542
3643
3744if __name__ == "__main__" :
You can’t perform that action at this time.
0 commit comments