MCPcopy Create free account
hub / github.com/apache/datafusion / table_list_udtf

Function table_list_udtf

datafusion-examples/examples/udf/table_list_udtf.rs:38–53  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

36// Defines a `table_list` UDTF that returns a list of tables within the provided session.
37
38pub async fn table_list_udtf() -> Result<()> {
39 let ctx = SessionContext::new();
40 ctx.register_udtf(FUNCTION_NAME, Arc::new(TableListUdtf));
41
42 // Register different kinds of tables.
43 ctx.sql("create view v as select 1")
44 .await?
45 .collect()
46 .await?;
47 ctx.sql("create table t(a int)").await?.collect().await?;
48
49 // Print results.
50 ctx.sql("select * from table_list()").await?.show().await?;
51
52 Ok(())
53}
54
55#[derive(Debug, Default)]
56struct TableListUdtf;

Callers 1

runMethod · 0.85

Calls 5

newFunction · 0.85
collectMethod · 0.80
sqlMethod · 0.80
showMethod · 0.80
register_udtfMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…