(
(let $1 (DataSource '"yt" '"/Root/plato"))
(let $2 '@@["StructType";[["key";["DataType";"String"]];["subkey";["DataType";"String"]];["value";["DataType";"String"]]]]@@)
(let $3 (YqlRowSpec '('NativeYtTypeFlags '0) '('StrictSchema '1) '('UniqueKeys '0) '('Type $2)))
(let $4 (YtMeta '('CanWrite '1) '('DoesExist '1) '('YqlCompatibleScheme '1) '('InferredScheme '0) '('IsDynamic '0) '('Attrs '('('"native_strict_schema" '"false")))))
(let $5 (YtStat '('Id '"Input2") '('RecordsCount '"4") '('DataSize '"164") '('ChunkCount '1) '('ModifyTime '0) '('Revision '0)))
(let $6 (YtTable '"Input2" $3 $4 $5 '() (Void) (Void) '"/Root/plato"))
(let $7 '('"key" '"value"))
(let $8 (lambda '($43 $44) (AsStruct '('"key" $43) '('"value" $44))))
(let $9 (DataType 'String))
(let $10 '('"key" $9))
(let $11 '('('"_logical_id" '2278) '('"_id" '"e4d3b02e-c8383cd2-8b13fe35-21f08d6d") '('"_wide_channels" (StructType $10 '('"value" $9)))))
(let $12 (DqPhyStage '() (lambda '() (block '(
  (let $41 (YtReadTable! world $1 '((YtSection '((YtPath $6 $7 (Void) (Void))) '()))))
  (let $42 (lambda '($45) (Member $45 '"key") (Member $45 '"value")))
  (return (FromFlow (ExpandMap (NarrowMap (DqReadWideWrap $41 '()) $8) $42)))
))) $11))
(let $13 '('0))
(let $14 (DqCnHashShuffle (TDqOutput $12 '0) $13 '0 '"HashV2"))
(let $15 '('Auto 'Many))
(let $16 (Bool 'true))
(let $17 '('"_partition_mode" '"aggregate"))
(let $18 (ListType $9))
(let $19 '('"_wide_channels" (StructType '('AggregateList0 $18) $10)))
(let $20 '('('"_logical_id" '2352) '('"_id" '"dabd14e6-730e912c-4d524c8a-d7a5cbd7") $17 $19))
(let $21 (DqPhyStage '($14) (lambda '($46) (block '(
  (let $47 (SqueezeToDict (NarrowMap (ToFlow $46) $8) (lambda '($50) (Member $50 '"key")) (lambda '($51) $51) $15))
  (let $48 (Condense1 (AssumeChopped (OrderedFlatMap $47 (lambda '($52) (OrderedFlatMap (DictPayloads $52) (lambda '($53) (Sort $53 $16 (lambda '($54) (Member $54 '"value"))))))) $7) (lambda '($55) (AsStruct '('AggregateList0 (AsList (Member $55 '"value"))) '('"key" (Member $55 '"key")))) (lambda '($56 $57) (AggrNotEquals (Member $56 '"key") (Member $57 '"key"))) (lambda '($58 $59) (AsStruct '('AggregateList0 (Insert (Member $59 'AggregateList0) (Member $58 '"value"))) '('"key" (Member $58 '"key"))))))
  (let $49 (lambda '($60) (Member $60 'AggregateList0) (Member $60 '"key")))
  (return (FromFlow (ExpandMap (NarrowMap (ExpandMap $48 $49) (lambda '($61 $62) (AsStruct '('AggregateList0 $61) '('"key" $62)))) $49)))
))) $20))
(let $22 (DqCnHashShuffle (TDqOutput $21 '0) '('1) '0 '"HashV2"))
(let $23 '('"key"))
(let $24 '('('"_logical_id" '2507) '('"_id" '"f86278b0-32e4bff-6d3211a8-5d12ca3c") $17 $19))
(let $25 (DqPhyStage '($22) (lambda '($63) (block '(
  (let $64 (SqueezeToDict (NarrowMap (ToFlow $63) (lambda '($67 $68) (AsStruct '('AggregateList0 $67) '('"key" $68)))) (lambda '($69) '((Member $69 '"key"))) (lambda '($70) $70) $15))
  (let $65 (Condense1 (AssumeChopped (OrderedFlatMap $64 (lambda '($71) (OrderedFlatMap (DictPayloads $71) (lambda '($72) $72)))) $23) (lambda '($73) $73) (lambda '($74 $75) (AggrNotEquals (Member $74 '"key") (Member $75 '"key"))) (lambda '($76 $77) $77)))
  (let $66 (lambda '($78) (Member $78 'AggregateList0) (Member $78 '"key")))
  (return (FromFlow (ExpandMap (NarrowMap (ExpandMap $65 $66) (lambda '($79 $80) (AsStruct '('AggregateList0 $79) '('"key" $80)))) $66)))
))) $24))
(let $26 (DqCnBroadcast (TDqOutput $25 '0)))
(let $27 '"_yql_key_selector_0")
(let $28 '('"values" $18))
(let $29 (StructType '($27 $9) $10 $28))
(let $30 '('('"_logical_id" '3173) '('"_id" '"eedb47f9-10e50d88-ba20903-7e42903f") '('"_wide_channels" $29)))
(let $31 (DqPhyStage '($26) (lambda '($81) (block '(
  (let $82 '('Many 'Hashed 'Compact))
  (let $83 (SqueezeToDict (NarrowMap (ToFlow $81) (lambda '($86 $87) (block '(
    (let $88 (AsStruct '('AggregateList0 $86) '('"key" $87)))
    (return '((Member $88 '"key") $88))
  )))) (lambda '($89) (Nth $89 '0)) (lambda '($90) (Nth $90 '1)) $82))
  (let $84 (CombineCore (Map (FlatMap $83 (lambda '($91) (block '(
    (let $92 (YtReadTable! world $1 '((YtSection '((YtPath $6 $23 (Void) (Void))) '()))))
    (return (MapJoinCore (NarrowMap (DqReadWideWrap $92 '()) (lambda '($93) (AsStruct '('"key" $93)))) $91 'Inner $23 $23 '('"key" '"a.key") '('AggregateList0 '"b.AggregateList0") '('"a.key") '('"b.key")))
  )))) (lambda '($94) (AsStruct '('"key" (Member $94 '"a.key")) '('"values" (Member $94 '"b.AggregateList0"))))) (lambda '($95) (StablePickle '((Member $95 '"key") (Member $95 '"values")))) (lambda '($96 $97) (block '(
    (let $98 (Unpickle (TupleType $9 $18) $96))
    (return (AsStruct '('"key" (Nth $98 '0)) '('"values" (Nth $98 '1))))
  ))) (lambda '($99 $100 $101) $101) (lambda '($102 $103) (block '(
    (let $104 (Member $103 '"key"))
    (let $105 (Member $103 '"values"))
    (return (Just (AsStruct '($27 (StablePickle '($104 $105))) '('"key" $104) '('"values" $105))))
  ))) '0))
  (let $85 (lambda '($106) (Member $106 $27) (Member $106 '"key") (Member $106 '"values")))
  (return (FromFlow (ExpandMap (NarrowMap (ExpandMap $84 $85) (lambda '($107 $108 $109) (AsStruct '($27 $107) '('"key" $108) '('"values" $109)))) $85)))
))) $30))
(let $32 (DqCnHashShuffle (TDqOutput $31 '0) $13 '0 '"HashV2"))
(let $33 (lambda '($131 $132) (AsStruct '('"key" $131) '('"values" $132))))
(let $34 (StructType $10 $28))
(let $35 '('('"_logical_id" '3563) '('"_id" '"ce46a188-7a75ac30-4cc98c47-a198c47e") '('"_wide_channels" $34)))
(let $36 (DqPhyStage '($32) (lambda '($110) (block '(
  (let $111 (lambda '($120) (Member $120 '"key") (Member $120 '"values")))
  (let $112 (lambda '($123 $124 $125) $124 $125))
  (let $113 (lambda '($126 $127 $128 $129 $130) $129 $130))
  (let $114 (WideCombiner (ExpandMap (NarrowMap (ToFlow $110) (lambda '($117 $118 $119) (AsStruct '('"key" $118) '('"values" $119)))) $111) '"" (lambda '($121 $122) (StablePickle '($121 $122))) $112 $113 $112))
  (let $115 (Sort (NarrowMap $114 $33) $16 (lambda '($133) (Member $133 '"key"))))
  (let $116 (lambda '($134) (Member $134 '"key") (Member $134 '"values")))
  (return (FromFlow (ExpandMap $115 $116)))
))) $35))
(let $37 (DqCnMerge (TDqOutput $36 '0) '('('0 '"Asc"))))
(let $38 (DqPhyStage '($37) (lambda '($135) (FromFlow (NarrowMap (ToFlow $135) $33))) '('('"_logical_id" '3575) '('"_id" '"8c5fe876-431be886-22ac7531-366a1977"))))
(let $39 '($12 $21 $25 $31 $36 $38))
(let $40 (DqCnResult (TDqOutput $38 '0) '('"values" '"key")))
(return (KqpPhysicalQuery '((KqpPhysicalTx $39 '($40) '() '('('"type" '"generic")))) '((KqpTxResultBinding (ListType $34) '0 '0)) '('('"type" '"query"))))
)
