SelectWithUnionQuery (children 1) ExpressionList (children 1) SelectQuery (children 4) ExpressionList (children 1) Function arrayJoin (alias k) (children 1) ExpressionList (children 1) Function arrayMap (children 1) ExpressionList (children 2) Function lambda (children 1) ExpressionList (children 2) Function tuple (children 1) ExpressionList (children 1) Identifier x Identifier x Function arraySort (children 1) ExpressionList (children 1) Function groupArray (children 1) ExpressionList (children 1) Function tuple (children 1) ExpressionList (children 2) Identifier ts Identifier n TablesInSelectQuery (children 1) TablesInSelectQueryElement (children 1) TableExpression (children 1) Subquery (children 1) SelectWithUnionQuery (children 1) ExpressionList (children 1) SelectQuery (children 3) ExpressionList (children 3) Identifier ts Identifier n Identifier z TablesInSelectQuery (children 2) TablesInSelectQueryElement (children 1) TableExpression (children 1) TableIdentifier system.one TablesInSelectQueryElement (children 1) ArrayJoin (children 1) ExpressionList (children 3) Literal Array_[UInt64_1, UInt64_3, UInt64_4, UInt64_5, UInt64_6] (alias ts) Literal Array_[UInt64_1, UInt64_2, UInt64_2, UInt64_2, UInt64_1] (alias n) Literal Array_[\'a\', \'a\', \'b\', \'a\', \'b\'] (alias z) ExpressionList (children 2) OrderByElement (children 1) Identifier n OrderByElement (children 1) Identifier ts Function equals (children 1) ExpressionList (children 2) Identifier z Literal \'a\' ExpressionList (children 1) Identifier z