apilloud commented on PR #16911:
URL: https://github.com/apache/beam/pull/16911#issuecomment-1119071169

   I printed node and fieldlist at the beginning of retrieveRexNode.
   ```
       Node: ProjectScan
       +-column_list=[$analytic.$analytic1#5]
       +-input_scan=
         +-AnalyticScan
           +-column_list=[KeyValue.Key#1, KeyValue.Value#2, KeyValue.ts#3, 
$analytic.$analytic1#5]
           +-input_scan=
           | +-TableScan(column_list=KeyValue.[Key#1, Value#2, ts#3], 
table=KeyValue, column_index_list=[0, 1, 2])
           +-function_group_list=
             +-AnalyticFunctionGroup
               +-analytic_function_list=
                 +-$analytic1#5 :=
                   +-AnalyticFunctionCall(ZetaSQL:sum(INT64) -> INT64)
                     +-ColumnRef(type=INT64, column=KeyValue.Key#1)
                     +-window_frame=
                       +-WindowFrame(frame_unit=ROWS)
                         +-start_expr=
                         | +-WindowFrameExpr(boundary_type=UNBOUNDED PRECEDING)
                         +-end_expr=
                           +-WindowFrameExpr(boundary_type=UNBOUNDED FOLLOWING)
   
       FieldList: [#0: $col1 BIGINT]
   ```
   
   If you walk up the stack one level, you'll see that this function call is 
`retrieveRexNode(zetaNode, input.getRowType().getFieldList())` This input does 
not match what we expect, the input FieldList has only 1 column but the ZetaSQL 
input AnalyticScan has 4 columns. That input is produced in 
`AnalyticScanConverter`, which is the code you are adding in this PR. It looks 
like the ZetaSQL `AnalyticScan` passes through all of the columns from the 
input but those are missing from your conversion. See the description of what 
it does here: 
https://github.com/google/zetasql/blob/1933acefe8eb10e293309a9fa7d7c7f1cb6bf8c4/zetasql/analyzer/analytic_function_resolver.cc#L870


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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to