amaliujia commented on a change in pull request #2103:
URL: https://github.com/apache/calcite/pull/2103#discussion_r469619227



##########
File path: core/src/main/java/org/apache/calcite/sql/SqlWindowTableFunction.java
##########
@@ -66,7 +86,53 @@ protected boolean 
throwValidationSignatureErrorOrReturnFalse(SqlCallBinding call
     }
   }
 
-  protected void validateColumnNames(SqlValidator validator,
+  /**
+   * Validate the heading operands are in the form:
+   * (ROW, DESCRIPTOR, DESCRIPTOR ..., other params).
+   *
+   * @param callBinding The call binding
+   * @param descriptors The number of descriptors following the first operand 
(e.g. the table)
+   *
+   * @return true if validation passes
+   */
+  protected boolean validateTableWithFollowingDescriptors(
+      SqlCallBinding callBinding, int descriptors) {
+    final SqlNode operand0 = callBinding.operand(0);
+    final SqlValidator validator = callBinding.getValidator();
+    final RelDataType type = validator.getValidatedNodeType(operand0);
+    if (type.getSqlTypeName() != SqlTypeName.ROW) {
+      return false;
+    }
+    for (int i = 1; i < descriptors + 1; i++) {
+      final SqlNode operand = callBinding.operand(i);

Review comment:
       Hi @danny0405  
   
   any suggestions on 
https://issues.apache.org/jira/browse/CALCITE-3780?focusedCommentId=17169620&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-17169620
   
   Your change will assume that the structure of window table functions be 
`row, (ROW, DESCRIPTOR, DESCRIPTOR ..., other params)`, in the comment we are 
thinking to make key descriptor of SESSION as optional, which might mean it 
will be moved to the last of the arguments so it becomes `SESSION(data TABLE, 
ts DESCRIPTOR, gap interval, key DESCRIPTOR optional)`




----------------------------------------------------------------
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]


Reply via email to