(
(let $1 (DataType 'Double))
(let $2 (DataType 'Uint64))
(let $3 (TupleType $1 $2))
(let $4 (OptionalType $3))
(let $5 (Bool 'false))
(let $6 (StructType '('_yql_agg_0 $3) '('_yql_agg_1 $4) '('_yql_agg_2 $4) '('_yql_agg_3 $4) '('_yql_agg_4 $4) '('_yql_agg_5 $3) '('_yql_agg_6 $4) '('_yql_agg_7 $4) '('_yql_agg_8 $3)))
(let $7 '('('"_logical_id" '15271) '('"_id" '"95d64f1f-39ef8558-3d969327-1d0cdd3") '('"_wide_channels" $6)))
(let $8 (DqPhyStage '() (lambda '() (block '(
  (let $19 '@@["StructType";[["key";["DataType";"Uint64"]];["subkey";["DataType";"Uint64"]]]]@@)
  (let $20 (YqlRowSpec '('NativeYtTypeFlags '0) '('StrictSchema '1) '('UniqueKeys '0) '('Type $19)))
  (let $21 (YtMeta '('CanWrite '1) '('DoesExist '1) '('YqlCompatibleScheme '1) '('InferredScheme '0) '('IsDynamic '0) '('Attrs '('('"native_strict_schema" 'false)))))
  (let $22 (YtStat '('Id '"Input") '('RecordsCount '"2") '('DataSize '"52") '('ChunkCount '1) '('ModifyTime '0) '('Revision '0)))
  (let $23 (YtTable '"Input" $20 $21 $22 '() (Void) (Void) '"/Root/plato"))
  (let $24 (YtReadTable! world (DataSource '"yt" '"/Root/plato") '((YtSection '((YtPath $23 '('"key") (Void) (Void) (Void))) '()))))
  (let $25 (OptionalType (DataType 'Int8)))
  (let $26 (lambda '($54) (Just '((Convert $54 'Double) (Uint64 '1)))))
  (let $27 (Nothing $4))
  (let $28 (OptionalType (DataType 'Uint16)))
  (let $29 (lambda '($55) (Just '((Convert $55 'Double) (Uint64 '1)))))
  (let $30 (OptionalType (DataType 'Int32)))
  (let $31 (lambda '($56) (Just '((Convert $56 'Double) (Uint64 '1)))))
  (let $32 (/ (Uint32 '1) (Uint32 '0)))
  (let $33 (IfPresent $32 (lambda '($57) (Just '((Convert $57 'Double) (Uint64 '1)))) $27))
  (let $34 (Convert (Int32 '"2") 'Double))
  (let $35 (Uint32 '"10"))
  (let $36 (Nothing (OptionalType $2)))
  (let $37 (lambda '($58) (Just '((Convert $58 'Double) (Uint64 '1)))))
  (let $38 (Uint32 '"100"))
  (let $39 (lambda '($43) (block '(
    (let $44 (Uint64 '1))
    (let $45 (IfPresent (SafeCast $43 $25) $26 $27))
    (let $46 (IfPresent (SafeCast $43 $28) $29 $27))
    (let $47 (IfPresent (SafeCast $43 $30) $31 $27))
    (let $48 (== $43 $35))
    (let $49 (Just $43))
    (let $50 (If $48 $49 $36))
    (let $51 (IfPresent $50 $37 $27))
    (let $52 (If (== $43 $38) $49 $36))
    (let $53 (IfPresent $52 $37 $27))
    (return (Convert $43 'Double) $44 $45 $46 $47 $33 $34 $44 $51 $53 (Convert $48 'Double) $44)
  ))))
  (let $40 (lambda '($72 $73 $74 $75 $76 $77 $78 $79 $80 $81 $82 $83 $84) (block '(
    (let $85 (Inc $74))
    (let $86 (SafeCast $72 $25))
    (let $87 (IfPresent $86 $26 $27))
    (let $88 (IfPresent $75 (lambda '($104) (IfPresent $86 (lambda '($105) (Just '((AggrAdd (Nth $104 '0) (Convert $105 'Double)) (Inc (Nth $104 '1))))) (Just $104))) $87))
    (let $89 (SafeCast $72 $28))
    (let $90 (IfPresent $89 $29 $27))
    (let $91 (IfPresent $76 (lambda '($106) (IfPresent $89 (lambda '($107) (Just '((AggrAdd (Nth $106 '0) (Convert $107 'Double)) (Inc (Nth $106 '1))))) (Just $106))) $90))
    (let $92 (SafeCast $72 $30))
    (let $93 (IfPresent $92 $31 $27))
    (let $94 (IfPresent $77 (lambda '($108) (IfPresent $92 (lambda '($109) (Just '((AggrAdd (Nth $108 '0) (Convert $109 'Double)) (Inc (Nth $108 '1))))) (Just $108))) $93))
    (let $95 (IfPresent $78 (lambda '($110) (IfPresent $32 (lambda '($111) (Just '((AggrAdd (Nth $110 '0) (Convert $111 'Double)) (Inc (Nth $110 '1))))) (Just $110))) $33))
    (let $96 (== $72 $35))
    (let $97 (Just $72))
    (let $98 (If $96 $97 $36))
    (let $99 (IfPresent $98 $37 $27))
    (let $100 (IfPresent $81 (lambda '($112) (IfPresent $98 (lambda '($113) (Just '((AggrAdd (Nth $112 '0) (Convert $113 'Double)) (Inc (Nth $112 '1))))) (Just $112))) $99))
    (let $101 (If (== $72 $38) $97 $36))
    (let $102 (IfPresent $101 $37 $27))
    (let $103 (IfPresent $82 (lambda '($114) (IfPresent $101 (lambda '($115) (Just '((AggrAdd (Nth $114 '0) (Convert $115 'Double)) (Inc (Nth $114 '1))))) (Just $114))) $102))
    (return (AggrAdd $73 (Convert $72 'Double)) $85 $88 $91 $94 $95 (AggrAdd $79 $34) $85 $100 $103 (AggrAdd $83 (Convert $96 'Double)) $85)
  ))))
  (let $41 (WideCondense1 (DqReadWideWrap $24 '()) $39 (lambda '($59 $60 $61 $62 $63 $64 $65 $66 $67 $68 $69 $70 $71) $5) $40))
  (let $42 (lambda '($116 $117 $118 $119 $120 $121 $122 $123 $124 $125 $126 $127) '($116 $117) $118 $119 $120 $121 '($122 $123) $124 $125 '($126 $127)))
  (return (FromFlow (WideMap $41 $42)))
))) $7))
(let $9 (DqCnUnionAll (TDqOutput $8 '0)))
(let $10 (OptionalType $1))
(let $11 (StructType '('Avg0 $1) '('Avg1 $10) '('Avg2 $10) '('Avg3 $10) '('Avg4 $10) '('Avg5 $1) '('Avg6 $10) '('Avg7 $10) '('Avg8 $1)))
(let $12 '('('"_logical_id" '15621) '('"_id" '"ac11a8b6-2a5e25dc-e014e043-212cc150") '('"_partition_mode" '"aggregate") '('"_wide_channels" $11)))
(let $13 (DqPhyStage '($9) (lambda '($128) (block '(
  (let $129 (lambda '($133 $134 $135 $136 $137 $138 $139 $140 $141) (Nth $133 '0) (Nth $133 '1) $134 $135 $136 $137 (Nth $138 '0) (Nth $138 '1) $139 $140 (Nth $141 '0) (Nth $141 '1)))
  (let $130 (lambda '($163 $164 $165 $166 $167 $168 $169 $170 $171 $172 $173 $174 $175 $176 $177 $178 $179 $180 $181 $182 $183) (block '(
    (let $184 (IfPresent $164 (lambda '($190) (IfPresent $174 (lambda '($191) (Just '((AggrAdd (Nth $190 '0) (Nth $191 '0)) (AggrAdd (Nth $190 '1) (Nth $191 '1))))) $164)) $174))
    (let $185 (IfPresent $165 (lambda '($192) (IfPresent $175 (lambda '($193) (Just '((AggrAdd (Nth $192 '0) (Nth $193 '0)) (AggrAdd (Nth $192 '1) (Nth $193 '1))))) $165)) $175))
    (let $186 (IfPresent $166 (lambda '($194) (IfPresent $176 (lambda '($195) (Just '((AggrAdd (Nth $194 '0) (Nth $195 '0)) (AggrAdd (Nth $194 '1) (Nth $195 '1))))) $166)) $176))
    (let $187 (IfPresent $167 (lambda '($196) (IfPresent $177 (lambda '($197) (Just '((AggrAdd (Nth $196 '0) (Nth $197 '0)) (AggrAdd (Nth $196 '1) (Nth $197 '1))))) $167)) $177))
    (let $188 (IfPresent $169 (lambda '($198) (IfPresent $180 (lambda '($199) (Just '((AggrAdd (Nth $198 '0) (Nth $199 '0)) (AggrAdd (Nth $198 '1) (Nth $199 '1))))) $169)) $180))
    (let $189 (IfPresent $170 (lambda '($200) (IfPresent $181 (lambda '($201) (Just '((AggrAdd (Nth $200 '0) (Nth $201 '0)) (AggrAdd (Nth $200 '1) (Nth $201 '1))))) $170)) $181))
    (return (AggrAdd (Nth $163 '0) $172) (AggrAdd (Nth $163 '1) $173) $184 $185 $186 $187 (AggrAdd (Nth $168 '0) $178) (AggrAdd (Nth $168 '1) $179) $188 $189 (AggrAdd (Nth $171 '0) $182) (AggrAdd (Nth $171 '1) $183))
  ))))
  (let $131 (WideCondense1 (ToFlow $128) $129 (lambda '($142 $143 $144 $145 $146 $147 $148 $149 $150 $151 $152 $153 $154 $155 $156 $157 $158 $159 $160 $161 $162) $5) $130))
  (let $132 (lambda '($202 $203 $204 $205 $206 $207 $208 $209 $210 $211 $212 $213) (block '(
    (let $214 (lambda '($222) (Just (Div (Nth $222 '0) (Nth $222 '1)))))
    (let $215 (Nothing $10))
    (let $216 (IfPresent $204 $214 $215))
    (let $217 (IfPresent $205 $214 $215))
    (let $218 (IfPresent $206 $214 $215))
    (let $219 (IfPresent $207 $214 $215))
    (let $220 (IfPresent $210 $214 $215))
    (let $221 (IfPresent $211 $214 $215))
    (return (Div $202 $203) $216 $217 $218 $219 (Div $208 $209) $220 $221 (Div $212 $213))
  ))))
  (return (FromFlow (WideMap $131 $132)))
))) $12))
(let $14 (DqCnUnionAll (TDqOutput $13 '0)))
(let $15 (DqPhyStage '($14) (lambda '($223) (block '(
  (let $224 (Condense (NarrowMap (ToFlow $223) (lambda '($225 $226 $227 $228 $229 $230 $231 $232 $233) (AsStruct '('Avg0 $225) '('Avg1 $226) '('Avg2 $227) '('Avg3 $228) '('Avg4 $229) '('Avg5 $230) '('Avg6 $231) '('Avg7 $232) '('Avg8 $233)))) (List (ListType $11)) (lambda '($234 $235) $5) (lambda '($236 $237) (AsList $236))))
  (return (FromFlow (Map $224 (lambda '($238) (block '(
    (let $239 (ToOptional $238))
    (return (AsStruct '('"column0" (Member $239 'Avg0)) '('"column1" (Member $239 'Avg1)) '('"column2" (Member $239 'Avg2)) '('"column3" (Member $239 'Avg3)) '('"column4" (Member $239 'Avg4)) '('"column5" (Member $239 'Avg5)) '('"column6" (Member $239 'Avg6)) '('"column7" (Member $239 'Avg7)) '('"column8" (Member $239 'Avg8))))
  ))))))
))) '('('"_logical_id" '15887) '('"_id" '"cdb69d5d-74819e16-eb8b9346-6d88959e"))))
(let $16 '($8 $13 $15))
(let $17 '('"column0" '"column1" '"column2" '"column3" '"column4" '"column5" '"column6" '"column7" '"column8"))
(let $18 (DqCnResult (TDqOutput $15 '0) $17))
(return (KqpPhysicalQuery '((KqpPhysicalTx $16 '($18) '() '('('"type" '"generic")))) '((KqpTxResultBinding (ListType (StructType '('"column0" $10) '('"column1" $10) '('"column2" $10) '('"column3" $10) '('"column4" $10) '('"column5" $10) '('"column6" $10) '('"column7" $10) '('"column8" $10))) '0 '0)) '('('"type" '"query"))))
)
