(
(let $1 (DataType 'String))
(let $2 '('group__yql_anonymous_window0_0 $1))
(let $3 '('group__yql_anonymous_window1_0 $1))
(let $4 '('group_w_0 $1))
(let $5 '('"key" $1))
(let $6 '('"subkey" $1))
(let $7 '('"value" $1))
(let $8 (StructType $2 $3 $4 $5 $6 $7))
(let $9 '('('"_logical_id" '10654) '('"_id" '"dd570f9d-9ef3c6a1-673cbaef-fd59a837") '('"_wide_channels" $8)))
(let $10 (DqPhyStage '() (lambda '() (block '(
  (let $33 '@@["StructType";[["key";["DataType";"String"]];["subkey";["DataType";"String"]];["value";["DataType";"String"]]]]@@)
  (let $34 (YqlRowSpec '('NativeYtTypeFlags '0) '('StrictSchema '1) '('UniqueKeys '0) '('Type $33)))
  (let $35 (YtMeta '('CanWrite '1) '('DoesExist '1) '('YqlCompatibleScheme '1) '('InferredScheme '0) '('IsDynamic '0) '('Attrs '('('"native_strict_schema" 'false)))))
  (let $36 (YtStat '('Id '"Input") '('RecordsCount '"4") '('DataSize '"166") '('ChunkCount '1) '('ModifyTime '0) '('Revision '0)))
  (let $37 (YtTable '"Input" $34 $35 $36 '() (Void) (Void) '"/Root/plato"))
  (let $38 '('"key" '"subkey" '"value"))
  (let $39 (YtReadTable! world (DataSource '"yt" '"/Root/plato") '((YtSection '((YtPath $37 $38 (Void) (Void))) '()))))
  (let $40 (lambda '($41 $42 $43) (Concat $41 (String '1)) (Concat $41 (String '"2")) (Concat $41 (String '"3")) $41 $42 $43))
  (return (FromFlow (WideMap (DqReadWideWrap $39 '()) $40)))
))) $9))
(let $11 (DqCnHashShuffle (TDqOutput $10 '0) '('0) '0 '"HashV2"))
(let $12 '('Auto 'Many))
(let $13 (Uint64 '1))
(let $14 (DataType 'Uint64))
(let $15 '('Count0 $14))
(let $16 (Bool 'false))
(let $17 (StructType $15 $3 $4 $5 $6 $7))
(let $18 '('('"_logical_id" '11114) '('"_id" '"52a4cba0-1fae1863-4dbddbf6-a2cf19b4") '('"_wide_channels" $17)))
(let $19 (DqPhyStage '($11) (lambda '($44) (block '(
  (let $45 (NarrowSqueezeToDict (ToFlow $44) (lambda '($48 $49 $50 $51 $52 $53) $48) (lambda '($54 $55 $56 $57 $58 $59) (AsStruct '('group__yql_anonymous_window0_0 $54) '('group__yql_anonymous_window1_0 $55) '('group_w_0 $56) '('"key" $57) '('"subkey" $58) '('"value" $59))) $12))
  (let $46 (Chopper (OrderedFlatMap $45 (lambda '($60) (OrderedFlatMap (DictPayloads $60) (lambda '($61) $61)))) (lambda '($62) (Member $62 'group__yql_anonymous_window0_0)) (lambda '($63 $64) (AggrNotEquals $63 (Member $64 'group__yql_anonymous_window0_0))) (lambda '($65 $66) (block '(
    (let $67 (Chain1Map $66 (lambda '($72) (block '(
      (let $73 '('Count0 $13))
      (let $74 (AsStruct $73 '('group__yql_anonymous_window0_0 (Member $72 'group__yql_anonymous_window0_0)) '('group__yql_anonymous_window1_0 (Member $72 'group__yql_anonymous_window1_0)) '('group_w_0 (Member $72 'group_w_0)) '('"key" (Member $72 '"key")) '('"subkey" (Member $72 '"subkey")) '('"value" (Member $72 '"value"))))
      (return '($74 (AsStruct $73)))
    ))) (lambda '($75 $76) (block '(
      (let $77 '('Count0 (Inc (Member (Nth $76 '1) 'Count0))))
      (let $78 (AsStruct $77 '('group__yql_anonymous_window0_0 (Member $75 'group__yql_anonymous_window0_0)) '('group__yql_anonymous_window1_0 (Member $75 'group__yql_anonymous_window1_0)) '('group_w_0 (Member $75 'group_w_0)) '('"key" (Member $75 '"key")) '('"subkey" (Member $75 '"subkey")) '('"value" (Member $75 '"value"))))
      (return '($78 (AsStruct $77)))
    )))))
    (let $68 (StructType $15 $2 $3 $4 $5 $6 $7))
    (let $69 (ListType $68))
    (let $70 (VariantType (StructType '('group $69) '('singleRow $68))))
    (let $71 (Condense1 $67 (lambda '($79) (block '(
      (let $80 (Variant (Nth $79 '0) 'singleRow $70))
      (return '((Void) $80))
    ))) (lambda '($81 $82) $16) (lambda '($83 $84) (block '(
      (let $85 (Nth $83 '0))
      (let $86 (Visit (Nth $84 '1) 'group (lambda '($87) (Variant (Insert $87 $85) 'group $70)) 'singleRow (lambda '($88) (Variant (AsList $88 $85) 'group $70))))
      (return '((Nth $84 '0) $86))
    )))))
    (return (OrderedFlatMap $71 (lambda '($89) (block '(
      (let $90 (Visit (Nth $89 '1) 'group (lambda '($91) (IfPresent (Last $91) (lambda '($92) (OrderedMap (Collect (Map $91 (lambda '($93) (AsStruct '('group__yql_anonymous_window0_0 (Member $93 'group__yql_anonymous_window0_0)) '('group__yql_anonymous_window1_0 (Member $93 'group__yql_anonymous_window1_0)) '('group_w_0 (Member $93 'group_w_0)) '('"key" (Member $93 '"key")) '('"subkey" (Member $93 '"subkey")) '('"value" (Member $93 '"value")))))) (lambda '($94) (AsStruct '('Count0 (Member $92 'Count0)) '('group__yql_anonymous_window0_0 (Member $94 'group__yql_anonymous_window0_0)) '('group__yql_anonymous_window1_0 (Member $94 'group__yql_anonymous_window1_0)) '('group_w_0 (Member $94 'group_w_0)) '('"key" (Member $94 '"key")) '('"subkey" (Member $94 '"subkey")) '('"value" (Member $94 '"value")))))) (List $69))) 'singleRow (lambda '($95) (AsList $95))))
      (return (Map $90 (lambda '($96) (AsStruct '('Count0 (Member $96 'Count0)) '('group__yql_anonymous_window1_0 (Member $96 'group__yql_anonymous_window1_0)) '('group_w_0 (Member $96 'group_w_0)) '('"key" (Member $96 '"key")) '('"subkey" (Member $96 '"subkey")) '('"value" (Member $96 '"value"))))))
    )))))
  )))))
  (let $47 (lambda '($97) (Member $97 'Count0) (Member $97 'group__yql_anonymous_window1_0) (Member $97 'group_w_0) (Member $97 '"key") (Member $97 '"subkey") (Member $97 '"value")))
  (return (FromFlow (ExpandMap $46 $47)))
))) $18))
(let $20 (DqCnHashShuffle (TDqOutput $19 '0) '('1) '0 '"HashV2"))
(let $21 '('Count1 $14))
(let $22 (StructType $15 $21 $4 $5 $6 $7))
(let $23 '('('"_logical_id" '11542) '('"_id" '"25ad86d6-42e09ce2-4cea85e-9bf075c2") '('"_wide_channels" $22)))
(let $24 (DqPhyStage '($20) (lambda '($98) (block '(
  (let $99 (NarrowSqueezeToDict (ToFlow $98) (lambda '($102 $103 $104 $105 $106 $107) $103) (lambda '($108 $109 $110 $111 $112 $113) (AsStruct '('Count0 $108) '('group__yql_anonymous_window1_0 $109) '('group_w_0 $110) '('"key" $111) '('"subkey" $112) '('"value" $113))) $12))
  (let $100 (Chopper (OrderedFlatMap $99 (lambda '($114) (OrderedFlatMap (DictPayloads $114) (lambda '($115) $115)))) (lambda '($116) (Member $116 'group__yql_anonymous_window1_0)) (lambda '($117 $118) (AggrNotEquals $117 (Member $118 'group__yql_anonymous_window1_0))) (lambda '($119 $120) (block '(
    (let $121 (Chain1Map $120 (lambda '($126) (block '(
      (let $127 '('Count1 $13))
      (let $128 (AsStruct '('Count0 (Member $126 'Count0)) $127 '('group__yql_anonymous_window1_0 (Member $126 'group__yql_anonymous_window1_0)) '('group_w_0 (Member $126 'group_w_0)) '('"key" (Member $126 '"key")) '('"subkey" (Member $126 '"subkey")) '('"value" (Member $126 '"value"))))
      (return '($128 (AsStruct $127)))
    ))) (lambda '($129 $130) (block '(
      (let $131 '('Count1 (Inc (Member (Nth $130 '1) 'Count1))))
      (let $132 (AsStruct '('Count0 (Member $129 'Count0)) $131 '('group__yql_anonymous_window1_0 (Member $129 'group__yql_anonymous_window1_0)) '('group_w_0 (Member $129 'group_w_0)) '('"key" (Member $129 '"key")) '('"subkey" (Member $129 '"subkey")) '('"value" (Member $129 '"value"))))
      (return '($132 (AsStruct $131)))
    )))))
    (let $122 (StructType $15 $21 $3 $4 $5 $6 $7))
    (let $123 (ListType $122))
    (let $124 (VariantType (StructType '('group $123) '('singleRow $122))))
    (let $125 (Condense1 $121 (lambda '($133) (block '(
      (let $134 (Variant (Nth $133 '0) 'singleRow $124))
      (return '((Void) $134))
    ))) (lambda '($135 $136) $16) (lambda '($137 $138) (block '(
      (let $139 (Nth $137 '0))
      (let $140 (Visit (Nth $138 '1) 'group (lambda '($141) (Variant (Insert $141 $139) 'group $124)) 'singleRow (lambda '($142) (Variant (AsList $142 $139) 'group $124))))
      (return '((Nth $138 '0) $140))
    )))))
    (return (OrderedFlatMap $125 (lambda '($143) (block '(
      (let $144 (Visit (Nth $143 '1) 'group (lambda '($145) (IfPresent (Last $145) (lambda '($146) (OrderedMap (Collect (Map $145 (lambda '($147) (AsStruct '('Count0 (Member $147 'Count0)) '('group__yql_anonymous_window1_0 (Member $147 'group__yql_anonymous_window1_0)) '('group_w_0 (Member $147 'group_w_0)) '('"key" (Member $147 '"key")) '('"subkey" (Member $147 '"subkey")) '('"value" (Member $147 '"value")))))) (lambda '($148) (AsStruct '('Count0 (Member $148 'Count0)) '('Count1 (Member $146 'Count1)) '('group__yql_anonymous_window1_0 (Member $148 'group__yql_anonymous_window1_0)) '('group_w_0 (Member $148 'group_w_0)) '('"key" (Member $148 '"key")) '('"subkey" (Member $148 '"subkey")) '('"value" (Member $148 '"value")))))) (List $123))) 'singleRow (lambda '($149) (AsList $149))))
      (return (Map $144 (lambda '($150) (AsStruct '('Count0 (Member $150 'Count0)) '('Count1 (Member $150 'Count1)) '('group_w_0 (Member $150 'group_w_0)) '('"key" (Member $150 '"key")) '('"subkey" (Member $150 '"subkey")) '('"value" (Member $150 '"value"))))))
    )))))
  )))))
  (let $101 (lambda '($151) (Member $151 'Count0) (Member $151 'Count1) (Member $151 'group_w_0) (Member $151 '"key") (Member $151 '"subkey") (Member $151 '"value")))
  (return (FromFlow (ExpandMap $100 $101)))
))) $23))
(let $25 (DqCnHashShuffle (TDqOutput $24 '0) '('"2") '0 '"HashV2"))
(let $26 (StructType '('"c1" $14) '('"c2" $14) '('"c3" $14) $5 $6 $7))
(let $27 '('('"_logical_id" '12064) '('"_id" '"6895ae8b-8392ab79-84c7ba1b-bea1689d") '('"_wide_channels" $26)))
(let $28 (DqPhyStage '($25) (lambda '($152) (block '(
  (let $153 (NarrowSqueezeToDict (ToFlow $152) (lambda '($157 $158 $159 $160 $161 $162) $159) (lambda '($163 $164 $165 $166 $167 $168) (AsStruct '('Count0 $163) '('Count1 $164) '('group_w_0 $165) '('"key" $166) '('"subkey" $167) '('"value" $168))) $12))
  (let $154 (Chopper (OrderedFlatMap $153 (lambda '($169) (OrderedFlatMap (DictPayloads $169) (lambda '($170) $170)))) (lambda '($171) (Member $171 'group_w_0)) (lambda '($172 $173) (AggrNotEquals $172 (Member $173 'group_w_0))) (lambda '($174 $175) (block '(
    (let $176 (Chain1Map $175 (lambda '($181) (block '(
      (let $182 '('Count2 $13))
      (let $183 (AsStruct '('Count0 (Member $181 'Count0)) '('Count1 (Member $181 'Count1)) $182 '('group_w_0 (Member $181 'group_w_0)) '('"key" (Member $181 '"key")) '('"subkey" (Member $181 '"subkey")) '('"value" (Member $181 '"value"))))
      (return '($183 (AsStruct $182)))
    ))) (lambda '($184 $185) (block '(
      (let $186 '('Count2 (Inc (Member (Nth $185 '1) 'Count2))))
      (let $187 (AsStruct '('Count0 (Member $184 'Count0)) '('Count1 (Member $184 'Count1)) $186 '('group_w_0 (Member $184 'group_w_0)) '('"key" (Member $184 '"key")) '('"subkey" (Member $184 '"subkey")) '('"value" (Member $184 '"value"))))
      (return '($187 (AsStruct $186)))
    )))))
    (let $177 (StructType $15 $21 '('Count2 $14) $4 $5 $6 $7))
    (let $178 (ListType $177))
    (let $179 (VariantType (StructType '('group $178) '('singleRow $177))))
    (let $180 (Condense1 $176 (lambda '($188) (block '(
      (let $189 (Variant (Nth $188 '0) 'singleRow $179))
      (return '((Void) $189))
    ))) (lambda '($190 $191) $16) (lambda '($192 $193) (block '(
      (let $194 (Nth $192 '0))
      (let $195 (Visit (Nth $193 '1) 'group (lambda '($196) (Variant (Insert $196 $194) 'group $179)) 'singleRow (lambda '($197) (Variant (AsList $197 $194) 'group $179))))
      (return '((Nth $193 '0) $195))
    )))))
    (return (OrderedFlatMap $180 (lambda '($198) (block '(
      (let $199 (Visit (Nth $198 '1) 'group (lambda '($200) (IfPresent (Last $200) (lambda '($201) (OrderedMap (Collect (Map $200 (lambda '($202) (AsStruct '('Count0 (Member $202 'Count0)) '('Count1 (Member $202 'Count1)) '('group_w_0 (Member $202 'group_w_0)) '('"key" (Member $202 '"key")) '('"subkey" (Member $202 '"subkey")) '('"value" (Member $202 '"value")))))) (lambda '($203) (AsStruct '('Count0 (Member $203 'Count0)) '('Count1 (Member $203 'Count1)) '('Count2 (Member $201 'Count2)) '('group_w_0 (Member $203 'group_w_0)) '('"key" (Member $203 '"key")) '('"subkey" (Member $203 '"subkey")) '('"value" (Member $203 '"value")))))) (List $178))) 'singleRow (lambda '($204) (AsList $204))))
      (return (Map $199 (lambda '($205) (AsStruct '('Count0 (Member $205 'Count0)) '('Count1 (Member $205 'Count1)) '('Count2 (Member $205 'Count2)) '('"key" (Member $205 '"key")) '('"subkey" (Member $205 '"subkey")) '('"value" (Member $205 '"value"))))))
    )))))
  )))))
  (let $155 (Sort (Map $154 (lambda '($206) (AsStruct '('"c1" (Member $206 'Count0)) '('"c2" (Member $206 'Count1)) '('"c3" (Member $206 'Count2)) '('"key" (Member $206 '"key")) '('"subkey" (Member $206 '"subkey")) '('"value" (Member $206 '"value"))))) (Bool 'true) (lambda '($207) (Member $207 '"subkey"))))
  (let $156 (lambda '($208) (Member $208 '"c1") (Member $208 '"c2") (Member $208 '"c3") (Member $208 '"key") (Member $208 '"subkey") (Member $208 '"value")))
  (return (FromFlow (ExpandMap $155 $156)))
))) $27))
(let $29 (DqCnMerge (TDqOutput $28 '0) '('('"4" '"Asc"))))
(let $30 (DqPhyStage '($29) (lambda '($209) (FromFlow (NarrowMap (ToFlow $209) (lambda '($210 $211 $212 $213 $214 $215) (AsStruct '('"c1" $210) '('"c2" $211) '('"c3" $212) '('"key" $213) '('"subkey" $214) '('"value" $215)))))) '('('"_logical_id" '12076) '('"_id" '"e9072a4b-3295a2f7-53292bb3-a5c68e33"))))
(let $31 '($10 $19 $24 $28 $30))
(let $32 (DqCnResult (TDqOutput $30 '0) '()))
(return (KqpPhysicalQuery '((KqpPhysicalTx $31 '($32) '() '('('"type" '"generic")))) '((KqpTxResultBinding (ListType $26) '0 '0)) '('('"type" '"query"))))
)
