[
https://issues.apache.org/jira/browse/CALCITE-4337?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17428190#comment-17428190
]
JING ZHANG commented on CALCITE-4337:
-------------------------------------
[~vilo] Thanks for your share. I agree with most of your views except the
following points:
1. Input tables with row semantics may not be partitioned. I don't think it's a
special case of partitioning because input rows could be assigned in
arbitrarily way, for example, random, round-roubin, any, broadcast and so on.
On this point, the SQL standard has the following description
!image-2021-10-13-20-19-55-855.png|width=734,height=105!
2. SQL standard also has description about PTF with multiple partitioned input
table parameters. I list one of the description as following, you could find
more in SQL standard file.
!image-2021-10-13-20-23-26-890.png|width=733,height=533!
3. `Time` column used to estimate activity of each partition for SESSION
function, we should not partition by `time` column. The SESSION function used
to group elements by sessions of activity. A session window closes when it does
not receive elements with same partition key for a certain period of time and a
new session window would open in the later. I would use the example in [session
table function document|https://calcite.apache.org/docs/reference.html#session]
[2]. In the case, partition key is `product`. If there are only 4 types of
products exists: 'p1', 'p2', 'p3', 'p4'. A session window on product 'p1' would
open after receives the first element with product 'p1', the window would close
if current task does not receive elements with product 'p1' for more than '20'
MINUTES. If an element with product 'p1' comes after the previous session
window closes, a new session window with product 'p1' would open.
SELECT * FROM TABLE(
SESSION(
TABLE orders PARTITION BY product,
DESCRIPTOR(rowtime),
INTERVAL '20' MINUTE));
> Support PARTITION BY clause in table function call
> --------------------------------------------------
>
> Key: CALCITE-4337
> URL: https://issues.apache.org/jira/browse/CALCITE-4337
> Project: Calcite
> Issue Type: New Feature
> Components: core
> Affects Versions: 1.26.0
> Reporter: Danny Chen
> Assignee: Danny Chen
> Priority: Major
> Labels: pull-request-available
> Attachments: image-2021-09-30-11-04-33-474.png,
> image-2021-09-30-11-05-12-400.png, image-2021-09-30-11-05-42-033.png,
> image-2021-10-13-20-19-55-855.png, image-2021-10-13-20-22-42-675.png,
> image-2021-10-13-20-23-26-890.png
>
> Time Spent: 1h 40m
> Remaining Estimate: 0h
>
> An example from the SQL standard 2016 Polymorphic Table Functions:
> {code:sql}
> SELECT W.wstart, W.wend, OI.customer, SUM(OI.price)
> FROM TABLE(SESSION(
> data => TABLE(order_item) AS OI PARTITION BY customer,
> timecol => DESCRIPTOR(order_time),
> timeout => INTERVAL '10' MINUTE)) W
> GROUP BY 1, 2, 3
> {code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)