(
(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 '"Input") '('RecordsCount '"4") '('DataSize '"166") '('ChunkCount '1) '('ModifyTime '0) '('Revision '0)))
(let $6 (YtTable '"Input" $3 $4 $5 '() (Void) (Void) '"/Root/plato"))
(let $7 (OptionalType (DataType 'Uint32)))
(let $8 (DataType 'Uint64))
(let $9 (lambda '($52) (Just (SafeCast $52 $8))))
(let $10 (OptionalType $8))
(let $11 (Nothing $10))
(let $12 (lambda '($58 $59) $59 $58))
(let $13 '('_yql_agg_0 $10))
(let $14 (DataType 'String))
(let $15 '('('"_logical_id" '3770) '('"_id" '"b6c86d4d-26a0995f-4795a589-648e55a") '('"_wide_channels" (StructType $13 '('"key" $14)))))
(let $16 (DqPhyStage '() (lambda '() (block '(
  (let $46 (YtReadTable! world $1 '((YtSection '((YtPath $6 '('"key" '"subkey") (Void) (Void))) '()))))
  (return (DqPhyHashCombine (WideToBlocks (FromFlow (DqReadWideWrap $46 '()))) '-1073741824 (lambda '($47 $48) $47) (lambda '($49 $50 $51) (IfPresent (SafeCast $51 $7) $9 $11)) (lambda '($53 $54 $55 $56) (block '(
    (let $57 (IfPresent (SafeCast $55 $7) $9 $11))
    (return (AggrAdd $57 $56))
  ))) $12))
))) $15))
(let $17 '('1))
(let $18 (DqCnHashShuffle (TDqOutput $16 '0) $17 '0 '"HashV2"))
(let $19 (lambda '($65 $66) $66))
(let $20 '('Auto 'Many))
(let $21 (lambda '($72 $73) $72 $73))
(let $22 (lambda '($74 $75 $76 $77) (AggrNotEquals $75 $77)))
(let $23 (lambda '($78 $79 $80 $81) (AggrAdd $78 $80) $81))
(let $24 (OptionalType $14))
(let $25 (Nothing $24))
(let $26 '('"_partition_mode" '"aggregate"))
(let $27 (StructType '('"grouping" $8) '('"key" $24) '('"sumLen" $10) '('"value" $24)))
(let $28 '('"_wide_channels" $27))
(let $29 '('('"_logical_id" '3956) '('"_id" '"d22b614b-31739f62-df545d6-2e15d015") $26 $28))
(let $30 (DqPhyStage '($18) (lambda '($60) (block '(
  (let $61 (NarrowSqueezeToDict (ToFlow (WideFromBlocks $60)) $19 (lambda '($67 $68) (AsStruct '('_yql_agg_0 $67) '('"key" $68))) $20))
  (let $62 (lambda '($71) (Member $71 '_yql_agg_0) (Member $71 '"key")))
  (let $63 (WideCondense1 (ExpandMap (OrderedFlatMap $61 (lambda '($69) (OrderedFlatMap (DictPayloads $69) (lambda '($70) $70)))) $62) $21 $22 $23))
  (let $64 (lambda '($82 $83) (Uint64 '1) (Just $83) $82 $25))
  (return (FromFlow (WideMap $63 $64)))
))) $29))
(let $31 '('('"_logical_id" '3827) '('"_id" '"e8e74dec-ddfba541-34379555-cccea465") '('"_wide_channels" (StructType $13 '('"value" $14)))))
(let $32 (DqPhyStage '() (lambda '() (block '(
  (let $84 (YtReadTable! world $1 '((YtSection '((YtPath $6 '('"subkey" '"value") (Void) (Void))) '()))))
  (return (DqPhyHashCombine (WideToBlocks (FromFlow (DqReadWideWrap $84 '()))) '-1073741824 (lambda '($85 $86) $86) (lambda '($87 $88 $89) (IfPresent (SafeCast $88 $7) $9 $11)) (lambda '($90 $91 $92 $93) (block '(
    (let $94 (IfPresent (SafeCast $91 $7) $9 $11))
    (return (AggrAdd $94 $93))
  ))) $12))
))) $31))
(let $33 (DqCnHashShuffle (TDqOutput $32 '0) $17 '0 '"HashV2"))
(let $34 '('('"_logical_id" '4002) '('"_id" '"29ad2eb1-f9b94a2d-84d9a0b0-567058c") $26 $28))
(let $35 (DqPhyStage '($33) (lambda '($95) (block '(
  (let $96 (NarrowSqueezeToDict (ToFlow (WideFromBlocks $95)) $19 (lambda '($100 $101) (AsStruct '('_yql_agg_0 $100) '('"value" $101))) $20))
  (let $97 (lambda '($104) (Member $104 '_yql_agg_0) (Member $104 '"value")))
  (let $98 (WideCondense1 (ExpandMap (OrderedFlatMap $96 (lambda '($102) (OrderedFlatMap (DictPayloads $102) (lambda '($103) $103)))) $97) $21 $22 $23))
  (let $99 (lambda '($105 $106) (Uint64 '2) $25 $105 (Just $106)))
  (return (FromFlow (WideMap $98 $99)))
))) $34))
(let $36 (DqCnParallelUnionAll (TDqOutput $30 '0)))
(let $37 (DqCnParallelUnionAll (TDqOutput $35 '0)))
(let $38 (lambda '($112 $113 $114 $115) (AsStruct '('"grouping" $112) '('"key" $113) '('"sumLen" $114) '('"value" $115))))
(let $39 '('('"_logical_id" '4317) '('"_id" '"4ea2f35e-ae34a7ee-f6e9cf6b-af12b424") $28))
(let $40 (DqPhyStage '($36 $37) (lambda '($107 $108) (block '(
  (let $109 (Bool 'true))
  (let $110 (Sort (Extend (NarrowMap (ToFlow $107) $38) (NarrowMap (ToFlow $108) $38)) '($109 $109) (lambda '($116) '((Member $116 '"key") (Member $116 '"value")))))
  (let $111 (lambda '($117) (Member $117 '"grouping") (Member $117 '"key") (Member $117 '"sumLen") (Member $117 '"value")))
  (return (FromFlow (ExpandMap $110 $111)))
))) $39))
(let $41 (DqCnMerge (TDqOutput $40 '0) '('('1 '"Asc") '('"3" '"Asc"))))
(let $42 (DqPhyStage '($41) (lambda '($118) (FromFlow (NarrowMap (ToFlow $118) $38))) '('('"_logical_id" '4329) '('"_id" '"5a31dbc4-54647fb0-f277234-474d6ee5"))))
(let $43 '($16 $30 $32 $35 $40 $42))
(let $44 '('"sumLen" '"key" '"value" '"grouping"))
(let $45 (DqCnResult (TDqOutput $42 '0) $44))
(return (KqpPhysicalQuery '((KqpPhysicalTx $43 '($45) '() '('('"type" '"generic")))) '((KqpTxResultBinding (ListType $27) '0 '0)) '('('"type" '"query"))))
)
