(
(declare %kqp%tx_result_binding_0_0 (OptionalType (StructType '('Avg0 (DataType 'Double)) '('Count0 (DataType 'Uint64)) '('Sum0 (DataType 'Int64)))))
(let $1 (DataType 'Double))
(let $2 (DataType 'Uint64))
(let $3 (DataType 'Int64))
(let $4 (StructType '('_yql_agg_0 (TupleType $1 $2)) '('_yql_agg_1 $2) '('_yql_agg_2 $3)))
(let $5 '('('"_logical_id" '2758) '('"_id" '"f3e067f-b77fe2a9-d4ada730-6d25d2d4") '('"_wide_channels" $4)))
(let $6 (DqPhyStage '() (lambda '() (block '(
  (let $20 (KqpTable '"/local/test_db/olap_yatests/clickbench/hits" '"72075186224037897:8" '"" '1))
  (let $21 (KqpBlockReadOlapTableRanges $20 (Void) '('"AdvEngineID" '"ResolutionWidth") '() '() (lambda '($24) (block '(
    (let $25 '('"_yql_agg_0_sum" 'sum '"ResolutionWidth"))
    (let $26 '('"_yql_agg_0_cnt" '"count" '"ResolutionWidth"))
    (let $27 '('_yql_agg_1 '"count" '"*"))
    (let $28 '('_yql_agg_2 'sum '"AdvEngineID"))
    (let $29 '($25 $26 $27 $28))
    (return (TKqpOlapAgg $24 $29 '()))
  )))))
  (let $22 (lambda '($30 $31 $32 $33 $34) (block '(
    (let $35 (BlockAsStruct '('"_yql_agg_0_cnt" $30) '('"_yql_agg_0_sum" $31) '('_yql_agg_1 $32) '('_yql_agg_2 $33)))
    (return (BlockMember $35 '"_yql_agg_0_sum") (BlockMember $35 '"_yql_agg_0_cnt") (BlockMember $35 '_yql_agg_1) (BlockMember $35 '_yql_agg_2) $34)
  ))))
  (let $23 (lambda '($36 $37 $38 $39) '((Convert $36 'Double) $37) $38 $39))
  (return (FromFlow (WideMap (ToFlow (WideFromBlocks (FromFlow (WideMap $21 $22)))) $23)))
))) $5))
(let $7 (DqCnUnionAll (TDqOutput $6 '0)))
(let $8 (OptionalType (StructType '('Avg0 $1) '('Count0 $2) '('Sum0 $3))))
(let $9 (DqPhyStage '($7) (lambda '($40) (block '(
  (let $41 (lambda '($45 $46 $47) (Nth $45 '0) (Nth $45 '1) $46 $47))
  (let $42 (Bool 'false))
  (let $43 (lambda '($55 $56 $57 $58 $59 $60 $61) (AggrAdd (Nth $55 '0) $58) (AggrAdd (Nth $55 '1) $59) (AggrAdd $56 $60) (AggrAdd $57 $61)))
  (let $44 (WideCondense1 (ToFlow $40) $41 (lambda '($48 $49 $50 $51 $52 $53 $54) $42) $43))
  (return (FromFlow (Condense (NarrowMap (Take $44 (Uint64 '1)) (lambda '($62 $63 $64 $65) (AsStruct '('Avg0 (Div $62 $63)) '('Count0 $64) '('Sum0 $65)))) (Nothing $8) (lambda '($66 $67) $42) (lambda '($68 $69) (Just $68)))))
))) '('('"_logical_id" '4590) '('"_id" '"5eb367ae-de116fe9-2fab22fc-44ce9bf6"))))
(let $10 (DqCnValue (TDqOutput $9 '0)))
(let $11 '('('"type" '"generic")))
(let $12 (KqpPhysicalTx '($6 $9) '($10) '() $11))
(let $13 '"%kqp%tx_result_binding_0_0")
(let $14 '('('"_logical_id" '4718) '('"_id" '"1ae5a90e-ee5ae636-d4bf8bb1-25bfb142") '('"_partition_mode" '"single")))
(let $15 (DqPhyStage '() (lambda '() (block '(
  (let $70 %kqp%tx_result_binding_0_0)
  (return (Iterator (AsList (AsStruct '('"column0" (Member $70 'Sum0)) '('"column1" (Coalesce (Member $70 'Count0) (Uint64 '0))) '('"column2" (Member $70 'Avg0))))))
))) $14))
(let $16 '('"column0" '"column1" '"column2"))
(let $17 (DqCnResult (TDqOutput $15 '0) $16))
(let $18 (KqpTxResultBinding $8 '0 '0))
(let $19 (KqpPhysicalTx '($15) '($17) '('($13 $18)) $11))
(return (KqpPhysicalQuery '($12 $19) '((KqpTxResultBinding (ListType (StructType '('"column0" (OptionalType $3)) '('"column1" $2) '('"column2" (OptionalType $1)))) '1 '0)) '('('"type" '"query"))))
)
