Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion datafusion/sql/src/relation/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,18 @@ impl<S: ContextProvider> SqlToRel<'_, S> {
}
})
.collect::<Vec<_>>();
let table_name_arg_str = args
.iter()
.map(|e| e.to_string())
.reduce(|a, b| format!("{a}, {b}"))
.unwrap_or_default();
let provider = self
.context_provider
.get_table_function_source(&tbl_func_name, args)?;
let plan = LogicalPlanBuilder::scan(
TableReference::Bare {
table: format!("{tbl_func_name}()").into(),
table: format!("{tbl_func_name}({table_name_arg_str})",)
.into(),
},
provider,
None,
Expand Down
24 changes: 12 additions & 12 deletions datafusion/sqllogictest/test_files/array.slt
Original file line number Diff line number Diff line change
Expand Up @@ -6023,8 +6023,8 @@ logical_plan
03)----SubqueryAlias: test
04)------SubqueryAlias: t
05)--------Projection:
06)----------Filter: substr(CAST(md5(CAST(tmp_table.value AS Utf8)) AS Utf8), Int64(1), Int64(32)) IN ([Utf8View("7f4b18de3cfeb9b4ac78c381ee2ad278"), Utf8View("a"), Utf8View("b"), Utf8View("c")])
07)------------TableScan: tmp_table projection=[value]
06)----------Filter: substr(CAST(md5(CAST(generate_series(Int64(1), Int64(100000)).value AS Utf8)) AS Utf8), Int64(1), Int64(32)) IN ([Utf8View("7f4b18de3cfeb9b4ac78c381ee2ad278"), Utf8View("a"), Utf8View("b"), Utf8View("c")])
07)------------TableScan: generate_series(Int64(1), Int64(100000)) projection=[value]
physical_plan
01)ProjectionExec: expr=[count(Int64(1))@0 as count(*)]
02)--AggregateExec: mode=Final, gby=[], aggr=[count(Int64(1))]
Expand Down Expand Up @@ -6052,8 +6052,8 @@ logical_plan
03)----SubqueryAlias: test
04)------SubqueryAlias: t
05)--------Projection:
06)----------Filter: substr(CAST(md5(CAST(tmp_table.value AS Utf8)) AS Utf8), Int64(1), Int64(32)) IN ([Utf8View("7f4b18de3cfeb9b4ac78c381ee2ad278"), Utf8View("a"), Utf8View("b"), Utf8View("c")])
07)------------TableScan: tmp_table projection=[value]
06)----------Filter: substr(CAST(md5(CAST(generate_series(Int64(1), Int64(100000)).value AS Utf8)) AS Utf8), Int64(1), Int64(32)) IN ([Utf8View("7f4b18de3cfeb9b4ac78c381ee2ad278"), Utf8View("a"), Utf8View("b"), Utf8View("c")])
07)------------TableScan: generate_series(Int64(1), Int64(100000)) projection=[value]
physical_plan
01)ProjectionExec: expr=[count(Int64(1))@0 as count(*)]
02)--AggregateExec: mode=Final, gby=[], aggr=[count(Int64(1))]
Expand Down Expand Up @@ -6081,8 +6081,8 @@ logical_plan
03)----SubqueryAlias: test
04)------SubqueryAlias: t
05)--------Projection:
06)----------Filter: substr(CAST(md5(CAST(tmp_table.value AS Utf8)) AS Utf8), Int64(1), Int64(32)) IN ([Utf8View("7f4b18de3cfeb9b4ac78c381ee2ad278"), Utf8View("a"), Utf8View("b"), Utf8View("c")])
07)------------TableScan: tmp_table projection=[value]
06)----------Filter: substr(CAST(md5(CAST(generate_series(Int64(1), Int64(100000)).value AS Utf8)) AS Utf8), Int64(1), Int64(32)) IN ([Utf8View("7f4b18de3cfeb9b4ac78c381ee2ad278"), Utf8View("a"), Utf8View("b"), Utf8View("c")])
07)------------TableScan: generate_series(Int64(1), Int64(100000)) projection=[value]
physical_plan
01)ProjectionExec: expr=[count(Int64(1))@0 as count(*)]
02)--AggregateExec: mode=Final, gby=[], aggr=[count(Int64(1))]
Expand Down Expand Up @@ -6112,8 +6112,8 @@ logical_plan
03)----SubqueryAlias: test
04)------SubqueryAlias: t
05)--------Projection:
06)----------Filter: array_has(LargeList([7f4b18de3cfeb9b4ac78c381ee2ad278, a, b, c]), substr(CAST(md5(CAST(tmp_table.value AS Utf8)) AS Utf8), Int64(1), Int64(32)))
07)------------TableScan: tmp_table projection=[value]
06)----------Filter: array_has(LargeList([7f4b18de3cfeb9b4ac78c381ee2ad278, a, b, c]), substr(CAST(md5(CAST(generate_series(Int64(1), Int64(100000)).value AS Utf8)) AS Utf8), Int64(1), Int64(32)))
07)------------TableScan: generate_series(Int64(1), Int64(100000)) projection=[value]
physical_plan
01)ProjectionExec: expr=[count(Int64(1))@0 as count(*)]
02)--AggregateExec: mode=Final, gby=[], aggr=[count(Int64(1))]
Expand Down Expand Up @@ -6141,8 +6141,8 @@ logical_plan
03)----SubqueryAlias: test
04)------SubqueryAlias: t
05)--------Projection:
06)----------Filter: substr(CAST(md5(CAST(tmp_table.value AS Utf8)) AS Utf8), Int64(1), Int64(32)) IN ([Utf8View("7f4b18de3cfeb9b4ac78c381ee2ad278"), Utf8View("a"), Utf8View("b"), Utf8View("c")])
07)------------TableScan: tmp_table projection=[value]
06)----------Filter: substr(CAST(md5(CAST(generate_series(Int64(1), Int64(100000)).value AS Utf8)) AS Utf8), Int64(1), Int64(32)) IN ([Utf8View("7f4b18de3cfeb9b4ac78c381ee2ad278"), Utf8View("a"), Utf8View("b"), Utf8View("c")])
07)------------TableScan: generate_series(Int64(1), Int64(100000)) projection=[value]
physical_plan
01)ProjectionExec: expr=[count(Int64(1))@0 as count(*)]
02)--AggregateExec: mode=Final, gby=[], aggr=[count(Int64(1))]
Expand Down Expand Up @@ -6172,8 +6172,8 @@ logical_plan
03)----SubqueryAlias: test
04)------SubqueryAlias: t
05)--------Projection:
06)----------Filter: substr(CAST(md5(CAST(tmp_table.value AS Utf8)) AS Utf8), Int64(1), Int64(32)) IS NOT NULL OR Boolean(NULL)
07)------------TableScan: tmp_table projection=[value]
06)----------Filter: substr(CAST(md5(CAST(generate_series(Int64(1), Int64(100000)).value AS Utf8)) AS Utf8), Int64(1), Int64(32)) IS NOT NULL OR Boolean(NULL)
07)------------TableScan: generate_series(Int64(1), Int64(100000)) projection=[value]
physical_plan
01)ProjectionExec: expr=[count(Int64(1))@0 as count(*)]
02)--AggregateExec: mode=Final, gby=[], aggr=[count(Int64(1))]
Expand Down
4 changes: 2 additions & 2 deletions datafusion/sqllogictest/test_files/table_functions.slt
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ SELECT * FROM generate_series(1, 5, NULL)
query TT
EXPLAIN SELECT * FROM generate_series(1, 5)
----
logical_plan TableScan: tmp_table projection=[value]
logical_plan TableScan: generate_series(Int64(1), Int64(5)) projection=[value]
physical_plan LazyMemoryExec: partitions=1, batch_generators=[generate_series: start=1, end=5, batch_size=8192]

#
Expand Down Expand Up @@ -270,7 +270,7 @@ SELECT * FROM range(1, 5, NULL)
query TT
EXPLAIN SELECT * FROM range(1, 5)
----
logical_plan TableScan: tmp_table projection=[value]
logical_plan TableScan: range(Int64(1), Int64(5)) projection=[value]
physical_plan LazyMemoryExec: partitions=1, batch_generators=[range: start=1, end=5, batch_size=8192]

#
Expand Down