Skip to content
Closed
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
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,40 @@ public TableFunctionAnalysis analyze(ConnectorSession session, ConnectorTransact
}
}

public static class ThreeTableArgumentsFunction
extends AbstractConnectorTableFunction
{
public ThreeTableArgumentsFunction()
{
super(
SCHEMA_NAME,
"three_table_arguments_function",
ImmutableList.of(
TableArgumentSpecification.builder()
.name("INPUT1")
.build(),
TableArgumentSpecification.builder()
.name("INPUT2")
.build(),
TableArgumentSpecification.builder()
.name("INPUT3")
.build()),
GENERIC_TABLE);
}

@Override
public TableFunctionAnalysis analyze(ConnectorSession session, ConnectorTransactionHandle transaction, Map<String, Argument> arguments)
{
return TableFunctionAnalysis.builder()
.handle(HANDLE)
.returnedType(new Descriptor(ImmutableList.of(new Descriptor.Field(COLUMN_NAME, Optional.of(BOOLEAN)))))
.requiredColumns("INPUT1", ImmutableList.of(0))
.requiredColumns("INPUT2", ImmutableList.of(0))
.requiredColumns("INPUT3", ImmutableList.of(0))
.build();
}
}

public static class OnlyPassThroughFunction
extends AbstractConnectorTableFunction
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import io.trino.connector.TestingTableFunctions.RequiredColumnsFunction;
import io.trino.connector.TestingTableFunctions.TableArgumentFunction;
import io.trino.connector.TestingTableFunctions.TableArgumentRowSemanticsFunction;
import io.trino.connector.TestingTableFunctions.ThreeTableArgumentsFunction;
import io.trino.connector.TestingTableFunctions.TwoScalarArgumentsFunction;
import io.trino.connector.TestingTableFunctions.TwoTableArgumentsFunction;
import io.trino.execution.DynamicFilterConfig;
Expand Down Expand Up @@ -6462,6 +6463,14 @@ public void testCopartitionColumns()
""")
.hasErrorCode(TYPE_MISMATCH)
.hasMessage("line 4:18: Partitioning columns in copartitioned tables have incompatible types");

analyze("""
SELECT * FROM TABLE(system.three_table_arguments_function(
input1 => TABLE(SELECT 1) t1(a) PARTITION BY (a),
input2 => TABLE(SELECT 2) t2(b) PARTITION BY (b),
input3 => TABLE(SELECT 3)
COPARTITION (t1, t2)))
""");
}

@Test
Expand Down Expand Up @@ -7040,6 +7049,7 @@ public ConnectorTransactionHandle getConnectorTransaction(TransactionId transact
new TableArgumentRowSemanticsFunction(),
new DescriptorArgumentFunction(),
new TwoTableArgumentsFunction(),
new ThreeTableArgumentsFunction(),
new OnlyPassThroughFunction(),
new MonomorphicStaticReturnTypeFunction(),
new PolymorphicStaticReturnTypeFunction(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -833,7 +833,7 @@ nonReserved
// IMPORTANT: this rule must only contain tokens. Nested rules are not supported. See SqlParser.exitNonReserved
: ABSENT | ADD | ADMIN | AFTER | ALL | ANALYZE | ANY | ARRAY | ASC | AT | AUTHORIZATION
| BERNOULLI | BOTH
| CALL | CASCADE | CATALOGS | COLUMN | COLUMNS | COMMENT | COMMIT | COMMITTED | CONDITIONAL | COPARTITION | COUNT | CURRENT
| CALL | CASCADE | CATALOGS | COLUMN | COLUMNS | COMMENT | COMMIT | COMMITTED | CONDITIONAL | COUNT | CURRENT
| DATA | DATE | DAY | DEFAULT | DEFINE | DEFINER | DENY | DESC | DESCRIPTOR | DISTRIBUTED | DOUBLE
| EMPTY | ENCODING | ERROR | EXCLUDING | EXPLAIN
| FETCH | FILTER | FINAL | FIRST | FOLLOWING | FORMAT | FUNCTIONS
Expand Down
1 change: 1 addition & 0 deletions docs/src/main/sphinx/language/reserved.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Keyword SQL:2016 SQL-92
``CASE`` reserved reserved
``CAST`` reserved reserved
``CONSTRAINT`` reserved reserved
``COPARTITION``
``CREATE`` reserved reserved
``CROSS`` reserved reserved
``CUBE`` reserved
Expand Down