[
https://issues.apache.org/jira/browse/CALCITE-4865?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17454347#comment-17454347
]
Jing Zhang commented on CALCITE-4865:
-------------------------------------
[~julianhyde] [~danny0405] Thanks a lot for attention.
> I don't understand why they changed the use of {{NamedRoutineCall}} to
> {{{}NamedRoutineTableFunctionCall{}}}. It looks as if {{NamedRoutineCall}} is
> no longer used after this change.
I don't change {{NamedRoutineCall}} to {{NamedRoutineTableFunctionCall, in fact
I add a new }}{{{}NamedRoutineTableFunctionCall method which is used for
TableFunction. The other function still uses NamedRoutineCall.{}}}{{{}{}}}
Because only TableFunction could receive table parameter, table parameter could
be with ORDER BY clause or PARTITION BY clause.
> I think they should just extend the syntax of {{{}NamedRoutineCall{}}}.
Make sense, {{NamedRoutineTableFunctionCall could extend
}}{{{}NamedRoutineCall, but has a flag isTableFunction to identify whether the
function is table function or not. Because table parameter is only allowed for
table function.{}}}{{{}{}}}
> I don't think it's possible for the parser to distinguish between a
> 'polymorphic table function', an old-style 'table function' and a regular
> function. So the parser should just support the widest possible syntax.
I agree with most of the view.
# I agree with Parser could not distinguish between a 'polymorphic table
function' and an old-style 'table function' which is also not necessary to
distinguish.
# I have reservations about this view parser could not distinguish between
'table function' and a regular function. Currently the parser already
identifies table function call in
[Parser.jj#L2174|[https://github.com/apache/calcite/blob/2317f4ea7779a38d128a756baa5ad21797f2eb6c/core/src/main/codegen/templates/Parser.jj#L2174].]
In summary, I could extend the syntax of {{NamedRoutineCall. Add }}{{a flag
isTableFunction to identify whether the function is table function or not. If
}}{{{}isTableFunction is true, parameter of Table Function could be table
parameter, which allows be with PARTITION BY clause or ORDER BY
clause.{}}}{{{}{}}}
WDYT, [~julianhyde] [~danny0405]
> Extends Table function to support Polymorphic Table Function
> ------------------------------------------------------------
>
> Key: CALCITE-4865
> URL: https://issues.apache.org/jira/browse/CALCITE-4865
> Project: Calcite
> Issue Type: Sub-task
> Components: core
> Reporter: Jing Zhang
> Priority: Major
> Labels: pull-request-available
> Attachments: image-2021-12-07-11-04-28-206.png
>
> Time Spent: 10m
> Remaining Estimate: 0h
>
> This Jira aims to extend existed Table function in order to support
> Polymorphic Table Function, including:
> * Introduces generic input table parameter which has 3 characteristics:
> ## Input tables have either row semantics or set semantics)
> ### Row semantics means that the the result of the PTF is decided on a
> row-by-row basis.
> ### Set semantics means that the outcome of the function depends on how the
> data is partitioned.
> ## The second characteristic, which applies only to input tables with set
> semantics, is whether the PTF can generate a result row even if the input
> table is empty.
> ## The third characteristic is whether the input table supports pass-through
> columns or not. Pass-through columns is a mechanism enabling the PTF to copy
> every column of an input row into columns of an output row.
> * Introduces generic input table parameter which has 3 characteristics:
> * Extends `SqlFunction` to support generic input table parameter
> * Adds validator for table function
> ## only input table parameter with set semantics could be partitioned or
> ordered
> ## At most has one input table parameter with row semantics
> * Updates `Parser.jj` to allow partition by clause and order by clause
> follow after input table parameter of table function
> * Adds test
--
This message was sent by Atlassian Jira
(v8.20.1#820001)