(
(declare %kqp%tx_result_binding_0_0 (OptionalType (StructType '('AggregateList0 (ListType (DataType 'String))) '('Sum0 (OptionalType (DataType 'Int64))) '('Sum1 (OptionalType (DataType 'Uint64))))))
(let $1 (OptionalType (DataType 'Uint64)))
(let $2 (lambda '($68) (Member $68 '_yql_preagg_Sum1)))
(let $3 (lambda '($78) (Member $78 '_yql_preagg_AggregateList0)))
(let $4 (lambda '($88) (Member $88 '_yql_preagg_Sum0)))
(let $5 (DqPhyStage '() (lambda '() (block '(
  (let $45 '@@["StructType";[["key";["DataType";"String"]];["subkey";["DataType";"String"]];["value";["DataType";"String"]]]]@@)
  (let $46 (YqlRowSpec '('NativeYtTypeFlags '0) '('StrictSchema '1) '('UniqueKeys '0) '('Type $45)))
  (let $47 (YtMeta '('CanWrite '1) '('DoesExist '1) '('YqlCompatibleScheme '1) '('InferredScheme '0) '('IsDynamic '0) '('HasRLS '0) '('Attrs '('('"native_strict_schema" 'false)))))
  (let $48 (YtStat '('Id '"Input3") '('RecordsCount '"7") '('DataSize '"287") '('ChunkCount '1) '('ModifyTime '0) '('Revision '0)))
  (let $49 (YtTable '"Input3" $46 $47 $48 '() (Void) (Void) '"/Root/plato"))
  (let $50 (YtReadTable! world (DataSource '"yt" '"/Root/plato") '((YtSection '((YtPath $49 '('"key" '"subkey") (Void) (Void) (Void))) '()))))
  (let $51 '('0))
  (return (FromFlow (Switch (NarrowMap (DqReadWideWrap $50 '()) (lambda '($52 $53) (block '(
    (let $54 (DataType 'Utf8))
    (let $55 (SafeCast $53 (OptionalType $54)))
    (let $56 '($54 '"" '1))
    (let $57 (CallableType '() '($54) $56))
    (let $58 '('('"blocks") '('"strict")))
    (let $59 (OptionalType (DataType 'Int32)))
    (let $60 (IfPresent $55 (lambda '($62) (block '(
      (let $63 (Udf '"Unicode.ToLower" (Void) (VoidType) '"" $57 (VoidType) '"" $58))
      (return (SafeCast (Apply $63 $62) $59))
    ))) (Nothing $59)))
    (let $61 (IfPresent $55 (lambda '($64) (block '(
      (let $65 (Udf '"Unicode.ToUpper" (Void) (VoidType) '"" $57 (VoidType) '"" $58))
      (return (SafeCast (Apply $65 $64) $1))
    ))) (Nothing $1)))
    (return (AsStruct '('_yql_preagg_AggregateList0 (Concat $52 (String '"_"))) '('_yql_preagg_Sum0 $60) '('_yql_preagg_Sum1 $61)))
  )))) '"134217728" $51 (lambda '($66) (CombineCore (Map $66 (lambda '($67) (AsStruct '('_yql_preagg_Sum1 (Member $67 '_yql_preagg_Sum1))))) $2 (lambda '($69 $70) (AsStruct '('_yql_preagg_Sum1 $69))) (lambda '($71 $72 $73) $73) (lambda '($74 $75) (Just $75)) '0)) $51 (lambda '($76) (CombineCore (Map $76 (lambda '($77) (AsStruct '('_yql_preagg_AggregateList0 (Member $77 '_yql_preagg_AggregateList0))))) $3 (lambda '($79 $80) (AsStruct '('_yql_preagg_AggregateList0 $79))) (lambda '($81 $82 $83) $83) (lambda '($84 $85) (Just $85)) '0)) $51 (lambda '($86) (CombineCore (Map $86 (lambda '($87) (AsStruct '('_yql_preagg_Sum0 (Member $87 '_yql_preagg_Sum0))))) $4 (lambda '($89 $90) (AsStruct '('_yql_preagg_Sum0 $89))) (lambda '($91 $92 $93) $93) (lambda '($94 $95) (Just $95)) '0)))))
))) '('('"_logical_id" '6837) '('"_id" '"94272d07-f3f98f71-c602c45-1a724de2"))))
(let $6 (DqCnHashShuffle (TDqOutput $5 '1) '('_yql_preagg_AggregateList0) '0 '"HashV2"))
(let $7 (Bool 'false))
(let $8 (DataType 'Int64))
(let $9 (OptionalType $8))
(let $10 (OptionalType $9))
(let $11 (Nothing $10))
(let $12 (OptionalType $1))
(let $13 (Nothing $12))
(let $14 (ListType (DataType 'String)))
(let $15 (OptionalType $14))
(let $16 (StructType '('_yql_agg_0 $15) '('_yql_agg_1 $10) '('_yql_agg_2 $12)))
(let $17 '('"_wide_channels" $16))
(let $18 '('('"_logical_id" '6168) '('"_id" '"474f7496-175a583e-97aa0128-e6db672a") $17))
(let $19 (DqPhyStage '($6) (lambda '($96) (block '(
  (let $97 (lambda '($102) $102))
  (let $98 (lambda '($103 $104)))
  (let $99 (DqPhyHashCombine (ExpandMap (ToFlow $96) $3) '"" $97 $98 $98 $97))
  (let $100 (Condense1 (NarrowMap $99 (lambda '($105) (AsStruct '('_yql_preagg_AggregateList0 $105)))) (lambda '($106) (AsList (Member $106 '_yql_preagg_AggregateList0))) (lambda '($107 $108) $7) (lambda '($109 $110) (Insert $110 (Member $109 '_yql_preagg_AggregateList0)))))
  (let $101 (lambda '($111) (Just $111) $11 $13))
  (return (FromFlow (ExpandMap $100 $101)))
))) $18))
(let $20 (DqCnHashShuffle (TDqOutput $5 '"2") '('_yql_preagg_Sum0) '0 '"HashV2"))
(let $21 (Nothing $15))
(let $22 '('('"_logical_id" '6628) '('"_id" '"8060a7b9-d4a1931b-97c9f274-d9aca97c") $17))
(let $23 (DqPhyStage '($20) (lambda '($112) (block '(
  (let $113 (lambda '($120) $120))
  (let $114 (lambda '($121 $122)))
  (let $115 (DqPhyHashCombine (ExpandMap (ToFlow $112) $4) '"" $113 $114 $114 $113))
  (let $116 (lambda '($125) (Just (SafeCast $125 $8))))
  (let $117 (Nothing $9))
  (let $118 (Condense1 (NarrowMap $115 (lambda '($123) (AsStruct '('_yql_preagg_Sum0 $123)))) (lambda '($124) (IfPresent (Member $124 '_yql_preagg_Sum0) $116 $117)) (lambda '($126 $127) $7) (lambda '($128 $129) (block '(
    (let $130 (IfPresent (Member $128 '_yql_preagg_Sum0) $116 $117))
    (return (AggrAdd $130 $129))
  )))))
  (let $119 (lambda '($131) $21 (Just $131) $13))
  (return (FromFlow (ExpandMap $118 $119)))
))) $22))
(let $24 (DqCnHashShuffle (TDqOutput $5 '0) '('_yql_preagg_Sum1) '0 '"HashV2"))
(let $25 '('('"_logical_id" '7028) '('"_id" '"79c1587a-b3af8793-7d8be532-7209e979") $17))
(let $26 (DqPhyStage '($24) (lambda '($132) (block '(
  (let $133 (lambda '($138) $138))
  (let $134 (lambda '($139 $140)))
  (let $135 (DqPhyHashCombine (ExpandMap (ToFlow $132) $2) '"" $133 $134 $134 $133))
  (let $136 (Condense1 (NarrowMap $135 (lambda '($141) (AsStruct '('_yql_preagg_Sum1 $141)))) $2 (lambda '($142 $143) $7) (lambda '($144 $145) (AggrAdd (Member $144 '_yql_preagg_Sum1) $145))))
  (let $137 (lambda '($146) $21 $11 (Just $146)))
  (return (FromFlow (ExpandMap $136 $137)))
))) $25))
(let $27 (DqCnParallelUnionAll (TDqOutput $19 '0)))
(let $28 (DqCnParallelUnionAll (TDqOutput $23 '0)))
(let $29 (DqCnParallelUnionAll (TDqOutput $26 '0)))
(let $30 '($27 $28 $29))
(let $31 '('('"_logical_id" '7106) '('"_id" '"d6c94413-55e7e0db-e657cfac-cc1ab405") $17))
(let $32 (DqPhyStage $30 (lambda '($147 $148 $149) (FromFlow (Extend (ToFlow $147) (ToFlow $148) (ToFlow $149)))) $31))
(let $33 (DqCnUnionAll (TDqOutput $32 '0)))
(let $34 (OptionalType (StructType '('AggregateList0 $14) '('Sum0 $9) '('Sum1 $1))))
(let $35 (DqPhyStage '($33) (lambda '($150) (block '(
  (let $151 (lambda '($154 $155 $156) $154 $155 $156))
  (let $152 (lambda '($163 $164 $165 $166 $167 $168) (block '(
    (let $169 (IfPresent $163 (lambda '($172) (IfPresent $166 (lambda '($173) (Just (Extend $172 $173))) $163)) $166))
    (let $170 (IfPresent $164 (lambda '($174) (IfPresent $167 (lambda '($175) (Just (AggrAdd $174 $175))) $164)) $167))
    (let $171 (IfPresent $165 (lambda '($176) (IfPresent $168 (lambda '($177) (Just (AggrAdd $176 $177))) $165)) $168))
    (return $169 $170 $171)
  ))))
  (let $153 (WideCondense1 (ToFlow $150) $151 (lambda '($157 $158 $159 $160 $161 $162) $7) $152))
  (return (FromFlow (Condense (NarrowMap (Take $153 (Uint64 '1)) (lambda '($178 $179 $180) (AsStruct '('AggregateList0 (Unwrap $178)) '('Sum0 (Unwrap $179)) '('Sum1 (Unwrap $180))))) (Nothing $34) (lambda '($181 $182) $7) (lambda '($183 $184) (Just $183)))))
))) '('('"_logical_id" '7216) '('"_id" '"8681b92d-b1e7a02d-abdf5c01-76aa133a"))))
(let $36 '($5 $19 $23 $26 $32 $35))
(let $37 (DqCnValue (TDqOutput $35 '0)))
(let $38 (KqpPhysicalTx $36 '($37) '() '('('"type" '"compute"))))
(let $39 '"%kqp%tx_result_binding_0_0")
(let $40 '('('"_logical_id" '7348) '('"_id" '"42830d6d-568ed50f-be2d5a72-c3419a14") '('"_partition_mode" '"single")))
(let $41 (DqPhyStage '() (lambda '() (block '(
  (let $185 %kqp%tx_result_binding_0_0)
  (let $186 (Sort (Coalesce (Member $185 'AggregateList0) (List $14)) (Bool 'true) (lambda '($187) $187)))
  (return (Iterator (AsList (AsStruct '('"kl" $186) '('"sks" (+ (Member $185 'Sum0) (Member $185 'Sum1)))))))
))) $40))
(let $42 (DqCnResult (TDqOutput $41 '0) '('"sks" '"kl")))
(let $43 (KqpTxResultBinding $34 '0 '0))
(let $44 (KqpPhysicalTx '($41) '($42) '('($39 $43)) '('('"type" '"generic"))))
(return (KqpPhysicalQuery '($38 $44) '((KqpTxResultBinding (ListType (StructType '('"kl" $14) '('"sks" $9))) '1 '0)) '('('"type" '"query"))))
)
