Skip to content

Commit 4529511

Browse files
committed
Fix table function docs
1 parent 45c28e1 commit 4529511

File tree

3 files changed

+40
-4
lines changed

3 files changed

+40
-4
lines changed

src/TableFunctions/TableFunctionDeltaLake.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,12 @@ using TableFunctionDeltaLake = ITableFunctionDataLake<TableFunctionDeltaLakeName
2020

2121
void registerTableFunctionDeltaLake(TableFunctionFactory & factory)
2222
{
23-
factory.registerFunction<TableFunctionDeltaLake>({.allow_readonly = false});
23+
factory.registerFunction<TableFunctionDeltaLake>(
24+
{.documentation = {
25+
.description=R"(The table function can be used to read the DeltaLake table stored on object store.)",
26+
.examples{{"deltaLake", "SELECT * FROM deltaLake(url, access_key_id, secret_access_key)", ""}},
27+
.categories{"DataLake"}},
28+
.allow_readonly = false});
2429
}
2530

2631
}

src/TableFunctions/TableFunctionExplain.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,16 @@ InterpreterExplainQuery TableFunctionExplain::getInterpreter(ContextPtr context)
147147

148148
void registerTableFunctionExplain(TableFunctionFactory & factory)
149149
{
150-
factory.registerFunction<TableFunctionExplain>();
150+
factory.registerFunction<TableFunctionExplain>({.documentation = {
151+
.description=R"(
152+
Returns result of EXPLAIN query.
153+
The function should not be called directly but can be invoked via `SELECT * FROM (EXPLAIN <query>)`.
154+
You can use this query to process the result of EXPLAIN further using SQL (e.g., in tests).
155+
Example:
156+
[example:1]
157+
)",
158+
.examples={{"1", "SELECT explain FROM (EXPLAIN AST SELECT * FROM system.numbers) WHERE explain LIKE '%Asterisk%'", ""}}
159+
}});
151160
}
152161

153162
}

src/TableFunctions/TableFunctionZeros.cpp

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,30 @@ StoragePtr TableFunctionZeros<multithreaded>::executeImpl(const ASTPtr & ast_fun
4848

4949
void registerTableFunctionZeros(TableFunctionFactory & factory)
5050
{
51-
factory.registerFunction<TableFunctionZeros<true>>();
52-
factory.registerFunction<TableFunctionZeros<false>>();
51+
factory.registerFunction<TableFunctionZeros<true>>({.documentation = {
52+
.description=R"(
53+
Generates a stream of zeros (a table with one column 'zero' of type 'UInt8') of specified size.
54+
This table function is used in performance tests, where you want to spend as little time as possible to data generation while testing some other parts of queries.
55+
In contrast to the `zeros_mt`, this table function is using single thread for data generation.
56+
Example:
57+
[example:1]
58+
This query will test the speed of `randomPrintableASCII` function using single thread.
59+
See also the `system.zeros` table.)",
60+
.examples={{"1", "SELECT count() FROM zeros(100000000) WHERE NOT ignore(randomPrintableASCII(10))", ""}}
61+
}});
62+
63+
factory.registerFunction<TableFunctionZeros<false>>({.documentation = {
64+
.description=R"(
65+
Generates a stream of zeros (a table with one column 'zero' of type 'UInt8') of specified size.
66+
This table function is used in performance tests, where you want to spend as little time as possible to data generation while testing some other parts of queries.
67+
In contrast to the `zeros`, this table function is using multiple threads for data generation, according to the `max_threads` setting.
68+
Example:
69+
[example:1]
70+
This query will test the speed of `randomPrintableASCII` function using multiple threads.
71+
See also the `system.zeros` table.
72+
)",
73+
.examples={{"1", "SELECT count() FROM zeros_mt(1000000000) WHERE NOT ignore(randomPrintableASCII(10))", ""}}
74+
}});
5375
}
5476

5577
template <bool multithreaded>

0 commit comments

Comments
 (0)