(
(let $1 (lambda '($42 $43 $44) $44 $42 $43))
(let $2 (DataType 'Uint64))
(let $3 (DataType 'String))
(let $4 '('"attr" $3))
(let $5 '('"urlBase" $3))
(let $6 (StructType '('_yql_agg_0 $2) $4 $5))
(let $7 '('('"_logical_id" '3921) '('"_id" '"b0abcf90-eba779f8-8c6197dd-9557225e") '('"_wide_channels" $6)))
(let $8 (DqPhyStage '() (lambda '() (block '(
  (let $23 '@@["StructType";[["key";["DataType";"String"]];["subkey";["DataType";"String"]];["value";["DataType";"String"]]]]@@)
  (let $24 (YqlRowSpec '('NativeYtTypeFlags '0) '('StrictSchema '1) '('UniqueKeys '0) '('Type $23)))
  (let $25 (YtMeta '('CanWrite '1) '('DoesExist '1) '('YqlCompatibleScheme '1) '('InferredScheme '0) '('IsDynamic '0) '('Attrs '('('"native_strict_schema" '"false")))))
  (let $26 (YtStat '('Id '"Input0") '('RecordsCount '"200") '('DataSize '"9557") '('ChunkCount '1) '('ModifyTime '0) '('Revision '0)))
  (let $27 (YtTable '"Input0" $24 $25 $26 '() (Void) (Void) '"/Root/plato"))
  (let $28 (YtReadTable! world (DataSource '"yt" '"/Root/plato") '((YtSection '((YtPath $27 '('"key" '"value") (Void) (Void))) '()))))
  (let $29 (lambda '($31 $32) $32 $31))
  (let $30 (Uint64 '1))
  (return (DqPhyHashCombine (WideToBlocks (FromFlow (DqReadWideWrap $28 '()))) '-1073741824 $29 (lambda '($33 $34 $35 $36) $30) (lambda '($37 $38 $39 $40 $41) (AggrAdd $41 $30)) $1))
))) $7))
(let $9 (DqCnHashShuffle (TDqOutput $8 '0) '('1 '2) '0 '"HashV2"))
(let $10 (StructType $4 '('"dupsCount" $2)))
(let $11 (StructType '('_yql_agg_0 (TupleType $10 $2)) '('_yql_agg_1 $2) $5))
(let $12 '('('"_logical_id" '4536) '('"_id" '"b7533b4-c87b0ac4-53a04414-beb60956") '('"_wide_channels" $11)))
(let $13 (DqPhyStage '($9) (lambda '($45) (block '(
  (let $46 (lambda '($50 $51 $52) $51 $52))
  (let $47 (lambda '($67 $68 $69 $70) $69 $68 $68 $68))
  (let $48 (lambda '($71 $72 $73 $74 $75 $76 $77 $78) (block '(
    (let $79 (AggrLess $77 $72))
    (let $80 (If $79 (AsStruct '('"attr" $73) '('"dupsCount" $72)) (AsStruct '('"attr" $75) '('"dupsCount" $76))))
    (let $81 (If $79 $72 $77))
    (return (Member $80 '"attr") (Member $80 '"dupsCount") $81 (AggrAdd $72 $78))
  ))))
  (let $49 (lambda '($82 $83 $84 $85 $86) '((AsStruct '('"attr" $83) '('"dupsCount" $84)) $85) $86 $82))
  (return (DqPhyHashCombine (WideToBlocks (FromFlow (WideCombiner (ToFlow (WideFromBlocks $45)) '"" $46 (lambda '($53 $54 $55 $56 $57) $55) (lambda '($58 $59 $60 $61 $62 $63) (AggrAdd $60 $63)) $1))) '-1073741824 (lambda '($64 $65 $66) $66) $47 $48 $49))
))) $12))
(let $14 (DqCnHashShuffle (TDqOutput $13 '0) '('2) '0 '"HashV2"))
(let $15 (StructType '('"allDocs" $2) '('"best" $10) $5))
(let $16 '('('"_logical_id" '5764) '('"_id" '"2fe4c670-4c381a2-d66b02b4-95c7c221") '('"_wide_channels" $15)))
(let $17 (DqPhyStage '($14) (lambda '($87) (block '(
  (let $88 (lambda '($96 $97 $98 $99) (block '(
    (let $100 (Nth $97 '0))
    (return (Member $100 '"attr") (Member $100 '"dupsCount") (Nth $97 '1) $98)
  ))))
  (let $89 (lambda '($101 $102 $103 $104 $105 $106 $107 $108) (block '(
    (let $109 (If (AggrLess $107 (Nth $102 '1)) $102 '((AsStruct '('"attr" $105) '('"dupsCount" $106)) $107)))
    (let $110 (Nth $109 '0))
    (return (Member $110 '"attr") (Member $110 '"dupsCount") (Nth $109 '1) (AggrAdd $103 $108))
  ))))
  (let $90 (lambda '($111 $112 $113 $114 $115) (AsStruct '('"attr" $112) '('"dupsCount" $113)) $115 $111))
  (let $91 (WideCombiner (ToFlow (WideFromBlocks $87)) '"" (lambda '($93 $94 $95) $95) $88 $89 $90))
  (let $92 (lambda '($116 $117 $118) $117 $116 $118))
  (return (FromFlow (WideMap (WideSort $91 '('('2 (Bool 'true)))) $92)))
))) $16))
(let $18 (DqCnMerge (TDqOutput $17 '0) '('('2 '"Asc"))))
(let $19 (DqPhyStage '($18) (lambda '($119) (FromFlow (NarrowMap (ToFlow $119) (lambda '($120 $121 $122) (AsStruct '('"allDocs" $120) '('"best" $121) '('"urlBase" $122)))))) '('('"_logical_id" '5776) '('"_id" '"d2693bad-b50ac3f2-dee63840-86f3c6f2"))))
(let $20 '($8 $13 $17 $19))
(let $21 '('"urlBase" '"allDocs" '"best"))
(let $22 (DqCnResult (TDqOutput $19 '0) $21))
(return (KqpPhysicalQuery '((KqpPhysicalTx $20 '($22) '() '('('"type" '"generic")))) '((KqpTxResultBinding (ListType $15) '0 '0)) '('('"type" '"query"))))
)
