amaliujia commented on a change in pull request #10946:
URL: https://github.com/apache/beam/pull/10946#discussion_r422350614



##########
File path: 
sdks/java/extensions/sql/zetasql/src/main/java/org/apache/beam/sdk/extensions/sql/zetasql/translation/ExpressionConverter.java
##########
@@ -551,6 +561,60 @@ public RexNode convertResolvedLiteral(ResolvedLiteral 
resolvedLiteral) {
     return ret;
   }
 
+  public RexCall convertTableValuedFunction(
+      RelNode input,
+      TableValuedFunction tvf,
+      List<ResolvedNodes.ResolvedTVFArgument> argumentList,
+      List<ResolvedColumn> inputTableColumns) {
+    switch (tvf.getName()) {
+      case "TUMBLE":
+        // TUMBLE tvf's second argument is descriptor.
+        ResolvedColumn wmCol =
+            
extractWatermarkColumnFromDescriptor(argumentList.get(1).getDescriptorArg());
+        if (wmCol.getType().getKind() != TYPE_TIMESTAMP) {
+          throw new IllegalArgumentException(
+              "Watermarked column should be TIMESTAMP type: "
+                  + extractWatermarkColumnNameFromDescriptor(

Review comment:
       I implemented `descriptor` in ZetaSQL. Per my implementation, a 
descriptor argument contains two class members:
   a. `ImmutableList<ResolvedColumn>`
   b. `ImmutableList<String>`
   
   The `ImmutableList<String>` contains exact column names where 
`ImmutableList<ResolvedColumn>` contains a list of `ColumnRef` that connects 
these exact columns names with columns from input table. 
   
   I am not 100% sure whether names in those `ColumnRef` always match exact 
names. So use `extractWatermarkColumnNameFromDescriptor` method to have a 100% 
guarantee on getting columns names that users typed into their queries.
   




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