(
(let $1 (Bool 'true))
(let $2 (DataType 'String))
(let $3 '('"key" $2))
(let $4 (DataType 'Int32))
(let $5 '('('"_logical_id" '2132) '('"_id" '"c8fb56f2-d9d36f3a-c97c666b-899997fa") '('"_wide_channels" (StructType $3 '('"value" (DictType $4 $2))))))
(let $6 (DqPhyStage '() (lambda '() (block '(
  (let $16 '@@["StructType";[["key";["DataType";"String"]];["subkey";["DataType";"String"]];["value";["DataType";"String"]]]]@@)
  (let $17 '('"key" '"subkey"))
  (let $18 (YqlRowSpec '('NativeYtTypeFlags '0) '('StrictSchema '1) '('UniqueKeys '0) '('Type $16) '('SortDirections '($1 $1)) '('SortMembers $17) '('SortedBy $17) '('SortedByTypes '($2 $2))))
  (let $19 (YtMeta '('CanWrite '1) '('DoesExist '1) '('YqlCompatibleScheme '1) '('InferredScheme '0) '('IsDynamic '0) '('Attrs '('('"native_strict_schema" '"false")))))
  (let $20 (YtStat '('Id '"Input") '('RecordsCount '"6") '('DataSize '"252") '('ChunkCount '1) '('ModifyTime '0) '('Revision '0)))
  (let $21 (YtTable '"Input" $18 $19 $20 '() (Void) (Void) '"/Root/plato"))
  (let $22 (YtReadTable! world (DataSource '"yt" '"/Root/plato") '((YtSection '((YtPath $21 '('"key" '"value") (Void) (Void))) '('('"unordered"))))))
  (let $23 (lambda '($24 $25) $24 (AsDict '((Int32 '1) $25))))
  (return (FromFlow (WideMap (DqReadWideWrap $22 '()) $23)))
))) $5))
(let $7 (DqCnHashShuffle (TDqOutput $6 '0) '('0) '0 '"HashV2"))
(let $8 (StructType '('"cnt" (DataType 'Uint64)) $3 '('"lst" (ListType (ListType (TupleType $4 $2))))))
(let $9 '('('"_logical_id" '2224) '('"_id" '"70f2b5c-506b4c3b-bf2411fa-935da0ab") '('"_wide_channels" $8)))
(let $10 (DqPhyStage '($7) (lambda '($26) (block '(
  (let $27 (ResourceType '"Set.SetResource.String"))
  (let $28 '($27))
  (let $29 '($2))
  (let $30 '('('"strict")))
  (let $31 (lambda '($38 $39 $40) (block '(
    (let $41 (DataType 'Uint32))
    (let $42 (TupleType (TupleType $2 $41) (StructType) $2))
    (let $43 (CallableType '() $28 $29 '($41)))
    (let $44 (Udf '"Set.Create" (Void) $42 '"" $43 (VoidType) '"" $30))
    (let $45 (NamedApply $44 '((StablePickle $40) (Uint32 '0)) (AsStruct) (DependsOn (String '"value"))))
    (return $45 (AsList $40) (Uint64 '1))
  ))))
  (let $32 (lambda '($46 $47 $48 $49 $50 $51) (block '(
    (let $52 (TupleType (TupleType $27) (StructType) $2))
    (let $53 (CallableType '() '((DataType 'Bool)) $28))
    (let $54 (Udf '"Set.WasChanged" (Void) $52 '"" $53 (VoidType) '"" $30))
    (let $55 (TupleType (TupleType $27 $2) (StructType) $2))
    (let $56 (CallableType '() $28 $28 $29))
    (let $57 (Udf '"Set.AddValue" (Void) $55 '"" $56 (VoidType) '"" $30))
    (let $58 (NamedApply $57 '($49 (StablePickle $48)) (AsStruct)))
    (let $59 (NamedApply $54 '($58) (AsStruct)))
    (let $60 (If $59 '($58 (Insert $50 $48)) '($49 $50)))
    (let $61 (If $59 (Inc $51) $51))
    (return (Nth $60 '0) (Nth $60 '1) $61)
  ))))
  (let $33 (lambda '($62 $63 $64 $65) $64 $65 $62))
  (let $34 (WideCombiner (ToFlow $26) '"" (lambda '($36 $37) $36) $31 $32 $33))
  (let $35 (lambda '($66 $67 $68) (block '(
    (let $69 (Sort (OrderedMap $66 (lambda '($70) (DictItems $70))) $1 (lambda '($71) $71)))
    (return $67 $68 $69)
  ))))
  (return (FromFlow (WideMap (WideSort $34 '('('2 $1))) $35)))
))) $9))
(let $11 (DqCnMerge (TDqOutput $10 '0) '('('1 '"Asc"))))
(let $12 (DqPhyStage '($11) (lambda '($72) (FromFlow (NarrowMap (ToFlow $72) (lambda '($73 $74 $75) (AsStruct '('"cnt" $73) '('"key" $74) '('"lst" $75)))))) '('('"_logical_id" '2236) '('"_id" '"e8c290b7-8bc18c33-6e57c3f2-7fa44432"))))
(let $13 '($6 $10 $12))
(let $14 '('"key" '"cnt" '"lst"))
(let $15 (DqCnResult (TDqOutput $12 '0) $14))
(return (KqpPhysicalQuery '((KqpPhysicalTx $13 '($15) '() '('('"type" '"generic")))) '((KqpTxResultBinding (ListType $8) '0 '0)) '('('"type" '"query"))))
)
