SQL Writer Semantics for One-Column Partitioning on Column 1

Example queries valid for one-column partitioning on column 1 (c1).

Example 1

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

In this example, the UDF describes to the server that the data is partitioned by the first column (T.x) 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.x ) )
V4 describe_parameter_get API returns: { 1, 1 }

Example 2

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

In this example, the UDF describes to the server that the data is partitioned by the first column (T.x) and the SQL writer only wants the query engine to execute the UDF on partitions. The server uses the UDF's preference for partitioning and as a result the same effective query in Example 1 is executed.

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.x.