amaliujia edited a comment on issue #1587: [CALCITE-3272] Support TUMBLE as 
Table Valued Function including an enumerable implementation, stream.iq and 
DESCRIPTOR
URL: https://github.com/apache/calcite/pull/1587#issuecomment-568799995
 
 
   @danny0405 
   I understand your concerns. Current implementation is less extensible as 
there will be more built-in table-valued function implementations and we cannot 
have many if-else with their own enumerable implementations.  An implementor 
interface would be desired for each implementation. 
   
   However, I believe current `CallImplementor` or `NotNullImplementor` is not 
enough for table-valued functions like `tumbling`. Table-valued functions 
cannot be done by the following code.
   ```
   // RexCalls that are suitable for `CallImplementor` or `NotNullImplementor`
   for (operand : call.operands())  {
      translate(operand);
   }
   
   translate(call, translatedOperands);
   ```  
   
   
   Because at least it requires `inputPhysType`, and very likely require 
`outputPhysType`and others params. Likely, table-valued function need following 
this:
   ```
   translate(table_valued_fucntion_call.operands()) // with the help of 
`inputPhysType`.
   translate(table_valued_fucntion_call);
   ```
   I can give a simple example: assume there is a table-valued function(TVF) 
that takes an table as input and a descriptor of a single column name. This TVF 
always return a table with all distinct values from one of columns that is 
specified by the descriptor in input table. In this example,  `inputPhysType` 
will be needed.
   
   
   I think we need a new interface for this purpose, I have filed 
[CALCITE-3629](https://issues.apache.org/jira/browse/CALCITE-3629). 
   
   In this PR, I made some changes to move some Tumbling code to `EnumUtils`, 
per the existing practice of enumerables and not every line of code can be 
moved out. Meanwhile, I would suggest to solve 
[CALCITE-3629](https://issues.apache.org/jira/browse/CALCITE-3629) when I add 
`HOP` implementation (a work after this PR). The rationale is we need more 
implementations to build an abstraction and then which leads to a good 
interface design.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to