SQL Writer Semantics for One-Column Partitioning on Column 2

Valid example queries for one-column partitioning on column 2 (c2).

Example 1

SELECT * FROM my_tpf( 
TABLE( SELECT T.x, T.y FROM T )
OVER( PARTITION BY T.y )

In this example, the UDF describes to the server that the data is partitioned by the first column (T.y), and the SQL writer also explicitly requests partitioning on the same column. When the two columns match, the above query proceeds without any errors using this negotiated query:

my_tpf( TABLE( SELECT T.x, T.y FROM T ) 
     OVER ( PARTITION BY T.y ) )
V4 describe_parameter_get API returns: { 1, 2 }

Example 2

SELECT * FROM my_tpf( 
  TABLE( SELECT T.x, T.y FROM T )
  OVER( PARTITION BY ANY )

In this example the SQL writer does not specify a specific column for partitioning. Instead the SQL writer partitions the input table. The UDF requests partitioning on column T.y, and as a result, the server partitions the input data on the column T.y.

Example 3

SELECT * FROM my_tpf( 
  TABLE( SELECT T.x, T.y FROM T )

SELECT * FROM my_tpf( 
  TABLE( SELECT T.x, T.y FROM T )
  OVER ( PARTITION BY DEFAULT )

This example shows that the SQL writer does not include the PARTITION BY clause or the PARTITION BY DEFAULT clause as part of the input table query specification. In this case, the specification requested by the UDF applies, which is to perform partitioning on column T.y.