(
(let $1 '('"key" '"subkey"))
(let $2 (lambda '($28 $29) (block '(
  (let $30 (OptionalType (DataType 'Uint32)))
  (let $31 (SafeCast $29 $30))
  (return (AsStruct '('_yql_sys_order_by_0 $31) '('_yql_sys_order_by_1 (* (SafeCast $28 $30) $31)) '('"key" $28) '('"subkey" $29)))
))))
(let $3 (Uint64 '3))
(let $4 (Uint64 '4))
(let $5 (AggrAdd $3 $4))
(let $6 '((Bool 'true) (Bool 'false)))
(let $7 (lambda '($32) '((Member $32 '_yql_sys_order_by_0) (Member $32 '_yql_sys_order_by_1))))
(let $8 (DataType 'String))
(let $9 (StructType '('"key" $8) '('"subkey" $8)))
(let $10 '('"_wide_channels" $9))
(let $11 '('('"_logical_id" '668) '('"_id" '"b7302dc2-14565ae1-821be2e4-78039a") $10))
(let $12 (DqPhyStage '() (lambda '() (block '(
  (let $20 '@@["StructType";[["key";["DataType";"String"]];["subkey";["DataType";"String"]];["value";["DataType";"String"]]]]@@)
  (let $21 (YqlRowSpec '('NativeYtTypeFlags '0) '('StrictSchema '1) '('UniqueKeys '0) '('Type $20)))
  (let $22 (YtMeta '('CanWrite '1) '('DoesExist '1) '('YqlCompatibleScheme '1) '('InferredScheme '0) '('IsDynamic '0) '('Attrs '('('"native_strict_schema" 'false)))))
  (let $23 (YtStat '('Id '"Input") '('RecordsCount '"10") '('DataSize '"424") '('ChunkCount '1) '('ModifyTime '0) '('Revision '0)))
  (let $24 (YtTable '"Input" $21 $22 $23 '() (Void) (Void) '"/Root/plato"))
  (let $25 (YtReadTable! world (DataSource '"yt" '"/Root/plato") '((YtSection '((YtPath $24 $1 (Void) (Void))) '()))))
  (let $26 (Top (NarrowMap (DqReadWideWrap $25 '()) $2) $5 $6 $7))
  (let $27 (lambda '($33) (Member $33 '"key") (Member $33 '"subkey")))
  (return (FromFlow (ExpandMap $26 $27)))
))) $11))
(let $13 (DqCnUnionAll (TDqOutput $12 '0)))
(let $14 '('('"_logical_id" '749) '('"_id" '"75847a64-fa2106b3-dbd24d7f-f18582e9") $10))
(let $15 (DqPhyStage '($13) (lambda '($34) (block '(
  (let $35 (Uint64 '18446744073709551615))
  (let $36 (If (> $3 (- $35 $4)) $35 $5))
  (let $37 (TopSort (NarrowMap (ToFlow $34) $2) (Min $36 $5) $6 $7))
  (let $38 (lambda '($39) (Member $39 '"key") (Member $39 '"subkey")))
  (return (FromFlow (ExpandMap $37 $38)))
))) $14))
(let $16 (DqCnUnionAll (TDqOutput $15 '0)))
(let $17 (DqPhyStage '($16) (lambda '($40) (FromFlow (NarrowMap (Take (Skip (ToFlow $40) $4) $3) (lambda '($41 $42) (AsStruct '('"key" $41) '('"subkey" $42)))))) '('('"_logical_id" '763) '('"_id" '"eaa86bad-a6a28295-613649f4-76db709c"))))
(let $18 '($12 $15 $17))
(let $19 (DqCnResult (TDqOutput $17 '0) $1))
(return (KqpPhysicalQuery '((KqpPhysicalTx $18 '($19) '() '('('"type" '"generic")))) '((KqpTxResultBinding (ListType $9) '0 '0)) '('('"type" '"query"))))
)
