SelectWithUnionQuery (children 1) ExpressionList (children 1) SelectQuery (children 4) ExpressionList (children 3) Subquery (alias arr) (children 1) SelectWithUnionQuery (children 1) ExpressionList (children 1) SelectQuery (children 2) ExpressionList (children 1) Function arrayCumSum (children 1) ExpressionList (children 1) Function groupArray (children 1) ExpressionList (children 1) Identifier amount TablesInSelectQuery (children 1) TablesInSelectQueryElement (children 1) TableExpression (children 1) Subquery (children 1) SelectWithUnionQuery (children 1) ExpressionList (children 1) SelectQuery (children 3) ExpressionList (children 1) Identifier amount TablesInSelectQuery (children 1) TablesInSelectQueryElement (children 1) TableExpression (children 1) TableIdentifier bm ExpressionList (children 1) OrderByElement (children 1) Identifier business_dttm Function plus (alias id) (children 1) ExpressionList (children 2) Literal UInt64_1 Function rowNumberInAllBlocks (children 1) ExpressionList Literal UInt64_3 (alias window_size) ExpressionList (children 3) Identifier amount Identifier business_dttm Function if (alias moving_sum) (children 1) ExpressionList (children 3) Function less (children 1) ExpressionList (children 2) Identifier id Identifier window_size Literal NULL Function round (children 1) ExpressionList (children 2) Function minus (children 1) ExpressionList (children 2) Function arrayElement (children 1) ExpressionList (children 2) Identifier arr Identifier id Function arrayElement (children 1) ExpressionList (children 2) Identifier arr Function minus (children 1) ExpressionList (children 2) Identifier id Identifier window_size Literal UInt64_4 TablesInSelectQuery (children 1) TablesInSelectQueryElement (children 1) TableExpression (children 1) Subquery (children 1) SelectWithUnionQuery (children 1) ExpressionList (children 1) SelectQuery (children 3) ExpressionList (children 2) Identifier amount Identifier business_dttm TablesInSelectQuery (children 1) TablesInSelectQueryElement (children 1) TableExpression (children 1) TableIdentifier bm ExpressionList (children 1) OrderByElement (children 1) Identifier business_dttm ExpressionList (children 1) OrderByElement (children 1) Identifier business_dttm