(
(let $1 (DataType 'Uint64))
(let $2 '('_yql_RowNumber0 $1))
(let $3 '('('"_logical_id" '3456) '('"_id" '"5192309b-456ea7b7-69cecf07-6c28ba5e") '('"_wide_channels" (StructType $2))))
(let $4 (DqPhyStage '() (lambda '() (block '(
  (let $13 '@@["StructType";[["key";["DataType";"String"]];["subkey";["DataType";"String"]];["value";["DataType";"String"]]]]@@)
  (let $14 (YqlRowSpec '('NativeYtTypeFlags '0) '('StrictSchema '1) '('UniqueKeys '0) '('Type $13)))
  (let $15 (YtMeta '('CanWrite '1) '('DoesExist '1) '('YqlCompatibleScheme '1) '('InferredScheme '0) '('IsDynamic '0) '('Attrs '('('"native_strict_schema" 'false)))))
  (let $16 (YtStat '('Id '"Input") '('RecordsCount '"4") '('DataSize '"166") '('ChunkCount '1) '('ModifyTime '0) '('Revision '0)))
  (let $17 (YtTable '"Input" $14 $15 $16 '() (Void) (Void) '"/Root/plato"))
  (let $18 (YtReadTable! world (DataSource '"yt" '"/Root/plato") '((YtSection '((YtPath $17 '() (Void) (Void) (Void))) '('('"syscolumns" '('"num")))))))
  (return (FromFlow (DqReadWideWrap $18 '())))
))) $3))
(let $5 (DqCnUnionAll (TDqOutput $4 '0)))
(let $6 (StructType '('"cnt" $1) '('"rn" $1)))
(let $7 '('('"_logical_id" '3773) '('"_id" '"64bff434-ad78398f-7c2d9000-e4e8d497") '('"_wide_channels" $6)))
(let $8 (DqPhyStage '($5) (lambda '($19) (block '(
  (let $20 (Chain1Map (NarrowMap (ToFlow $19) (lambda '($27) (AsStruct '('_yql_RowNumber0 $27)))) (lambda '($28) (block '(
    (let $29 '('Count0 (Uint64 '1)))
    (return '((AsStruct $29 '('_yql_RowNumber0 (Member $28 '_yql_RowNumber0))) (AsStruct $29)))
  ))) (lambda '($30 $31) (block '(
    (let $32 '('Count0 (Inc (Member (Nth $31 '1) 'Count0))))
    (return '((AsStruct $32 '('_yql_RowNumber0 (Member $30 '_yql_RowNumber0))) (AsStruct $32)))
  )))))
  (let $21 (StructType '('Count0 $1) $2))
  (let $22 (ListType $21))
  (let $23 (VariantType (StructType '('group $22) '('singleRow $21))))
  (let $24 (Condense1 $20 (lambda '($33) (block '(
    (let $34 (Variant (Nth $33 '0) 'singleRow $23))
    (return '((Void) $34))
  ))) (lambda '($35 $36) (Bool 'false)) (lambda '($37 $38) (block '(
    (let $39 (Nth $37 '0))
    (let $40 (Visit (Nth $38 '1) 'group (lambda '($41) (Variant (Insert $41 $39) 'group $23)) 'singleRow (lambda '($42) (Variant (AsList $42 $39) 'group $23))))
    (return '((Nth $38 '0) $40))
  )))))
  (let $25 (Sort (FlatMap $24 (lambda '($43) (Visit (Nth $43 '1) 'group (lambda '($44) (block '(
    (let $45 (IfPresent (Last $44) (lambda '($46) (OrderedMap (Collect (Map $44 (lambda '($47) (AsStruct '('_yql_RowNumber0 (Member $47 '_yql_RowNumber0)))))) (lambda '($48) (AsStruct '('Count0 (Member $46 'Count0)) '('_yql_RowNumber0 (Member $48 '_yql_RowNumber0)))))) (List $22)))
    (return (Map $45 (lambda '($49) (AsStruct '('"cnt" (Member $49 'Count0)) '('"rn" (Member $49 '_yql_RowNumber0))))))
  ))) 'singleRow (lambda '($50) (AsList (AsStruct '('"cnt" (Member $50 'Count0)) '('"rn" (Member $50 '_yql_RowNumber0)))))))) (Bool 'true) (lambda '($51) (Member $51 '"rn"))))
  (let $26 (lambda '($52) (Member $52 '"cnt") (Member $52 '"rn")))
  (return (FromFlow (ExpandMap $25 $26)))
))) $7))
(let $9 (DqCnMerge (TDqOutput $8 '0) '('('1 '"Asc"))))
(let $10 (DqPhyStage '($9) (lambda '($53) (FromFlow (NarrowMap (ToFlow $53) (lambda '($54 $55) (AsStruct '('"cnt" $54) '('"rn" $55)))))) '('('"_logical_id" '3785) '('"_id" '"e111f176-6a23be1e-e31e3304-1eca027d"))))
(let $11 '($4 $8 $10))
(let $12 (DqCnResult (TDqOutput $10 '0) '('"rn" '"cnt")))
(return (KqpPhysicalQuery '((KqpPhysicalTx $11 '($12) '() '('('"type" '"generic")))) '((KqpTxResultBinding (ListType $6) '0 '0)) '('('"type" '"query"))))
)
