Skip to content
Merged
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
16 changes: 8 additions & 8 deletions docs/src/main/sphinx/develop/table-functions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ Table function declaration

To declare a table function, you need to implement ``ConnectorTableFunction``.
Subclassing ``AbstractConnectorTableFunction`` is a convenient way to do it.
The connector's ``getTableFunctions()`` method must return a ``Provider`` of
your implementation.
The connector's ``getTableFunctions()`` method must return a set of your
implementations.

The constructor
^^^^^^^^^^^^^^^
Expand All @@ -34,12 +34,12 @@ The constructor
"my_function",
List.of(
ScalarArgumentSpecification.builder()
.name("column_count")
.name("COLUMN_COUNT")
.type(INTEGER)
.defaultValue(2)
.build(),
ScalarArgumentSpecification.builder()
.name("row_count")
.name("ROW_COUNT")
.type(INTEGER)
.build()),
GENERIC_TABLE);
Expand All @@ -66,7 +66,7 @@ skipped during invocation:
.. code-block:: java

ScalarArgumentSpecification.builder()
.name("column_count")
.name("COLUMN_COUNT")
.type(INTEGER)
.defaultValue(2)
.build()
Expand All @@ -77,7 +77,7 @@ invocation:
.. code-block:: java

ScalarArgumentSpecification.builder()
.name("row_count")
.name("ROW_COUNT")
Comment thread
nineinchnick marked this conversation as resolved.
Outdated
.type(INTEGER)
.build()

Expand Down Expand Up @@ -105,8 +105,8 @@ is also the place to perform custom checks on the arguments:
@Override
public TableFunctionAnalysis analyze(ConnectorSession session, ConnectorTransactionHandle transaction, Map<String, Argument> arguments)
{
long columnCount = (long) ((ScalarArgument) arguments.get("column_count")).getValue();
long rowCount = (long) ((ScalarArgument) arguments.get("row_count")).getValue();
long columnCount = (long) ((ScalarArgument) arguments.get("COLUMN_COUNT")).getValue();
long rowCount = (long) ((ScalarArgument) arguments.get("ROW_COUNT")).getValue();

// custom validation of arguments
if (columnCount < 1 || columnCount > 3) {
Expand Down