(
(let $1 (DataType 'Double))
(let $2 (OptionalType (TupleType $1 (DataType 'Uint64))))
(let $3 (Bool 'false))
(let $4 (lambda '($39) $39))
(let $5 '('('"_logical_id" '1738) '('"_id" '"acc1b930-869b0e31-489e890d-15953e11") '('"_wide_channels" (StructType '('_yql_agg_0 $2)))))
(let $6 (DqPhyStage '() (lambda '() (block '(
  (let $16 '@@["StructType";[["key";["OptionalType";["DataType";"Uint64"]]];["subkey";["DataType";"Uint64"]]]]@@)
  (let $17 (YqlRowSpec '('NativeYtTypeFlags '0) '('StrictSchema '1) '('UniqueKeys '0) '('Type $16)))
  (let $18 (YtMeta '('CanWrite '1) '('DoesExist '1) '('YqlCompatibleScheme '1) '('InferredScheme '0) '('IsDynamic '0) '('Attrs '('('"native_strict_schema" 'false)))))
  (let $19 (YtStat '('Id '"Input") '('RecordsCount '"5") '('DataSize '"126") '('ChunkCount '1) '('ModifyTime '0) '('Revision '0)))
  (let $20 (YtTable '"Input" $17 $18 $19 '() (Void) (Void) '"/Root/plato"))
  (let $21 (YtReadTable! world (DataSource '"yt" '"/Root/plato") '((YtSection '((YtPath $20 '('"key" '"subkey") (Void) (Void))) '()))))
  (let $22 (lambda '($30) (Just '((Convert $30 'Double) (Uint64 '1)))))
  (let $23 (Nothing $2))
  (let $24 (Condense1 (NarrowMap (WideFilter (DqReadWideWrap $21 '()) (lambda '($25 $26) (!= $26 (Int32 '"5")))) (lambda '($27 $28) (AsStruct '('"key" $27)))) (lambda '($29) (IfPresent (Member $29 '"key") $22 $23)) (lambda '($31 $32) $3) (lambda '($33 $34) (block '(
    (let $35 (Member $33 '"key"))
    (let $36 (IfPresent $35 $22 $23))
    (return (IfPresent $34 (lambda '($37) (IfPresent $35 (lambda '($38) (Just '((AggrAdd (Nth $37 '0) (Convert $38 'Double)) (Inc (Nth $37 '1))))) (Just $37))) $36))
  )))))
  (return (FromFlow (ExpandMap $24 $4)))
))) $5))
(let $7 (DqCnUnionAll (TDqOutput $6 '0)))
(let $8 (OptionalType $1))
(let $9 (StructType '('Avg0 $8)))
(let $10 '('('"_logical_id" '4874) '('"_id" '"a37f954c-202a5497-6f4be77c-d51fdd0b") '('"_partition_mode" '"aggregate") '('"_wide_channels" $9)))
(let $11 (DqPhyStage '($7) (lambda '($40) (block '(
  (let $41 (WideCondense1 (ToFlow $40) $4 (lambda '($42 $43) $3) (lambda '($44 $45) (IfPresent $44 (lambda '($46) (IfPresent $45 (lambda '($47) (Just '((AggrAdd (Nth $46 '0) (Nth $47 '0)) (AggrAdd (Nth $46 '1) (Nth $47 '1))))) $44)) $45))))
  (return (FromFlow (WideMap $41 (lambda '($48) (IfPresent $48 (lambda '($49) (Just (Div (Nth $49 '0) (Nth $49 '1)))) (Nothing $8))))))
))) $10))
(let $12 (DqCnUnionAll (TDqOutput $11 '0)))
(let $13 (DqPhyStage '($12) (lambda '($50) (block '(
  (let $51 (Condense (NarrowMap (ToFlow $50) (lambda '($52) (AsStruct '('Avg0 $52)))) (List (ListType $9)) (lambda '($53 $54) $3) (lambda '($55 $56) (AsList $55))))
  (return (FromFlow (Map $51 (lambda '($57) (AsStruct '('"column0" (Member (ToOptional $57) 'Avg0)))))))
))) '('('"_logical_id" '4924) '('"_id" '"2a8fb463-2cde9ecc-e218bb2c-6f685c43"))))
(let $14 '($6 $11 $13))
(let $15 (DqCnResult (TDqOutput $13 '0) '('"column0")))
(return (KqpPhysicalQuery '((KqpPhysicalTx $14 '($15) '() '('('"type" '"generic")))) '((KqpTxResultBinding (ListType (StructType '('"column0" $8))) '0 '0)) '('('"type" '"query"))))
)
