You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by GitBox <gi...@apache.org> on 2020/08/12 02:26:29 UTC

[GitHub] [calcite] chunweilei commented on a change in pull request #2103: [CALCITE-4171] Support named parameters for table window functions

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



##########
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:
       Why use `i < descriptors + 1` rathen than `i <= descriptors`?




----------------------------------------------------------------
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:
users@infra.apache.org