(
(declare %kqp%tx_result_binding_0_0 (OptionalType (StructType '('Sum0 (DataType 'Double)) '('Sum1 (DataType 'Double)))))
(let $1 (DataType 'Double))
(let $2 '('"l_discount" $1))
(let $3 '('"l_extendedprice" $1))
(let $4 (DataType 'Int64))
(let $5 '('"l_partkey" $4))
(let $6 (Bool 'false))
(let $7 (StructType $2 $3 $5))
(let $8 '('('"_logical_id" '2486) '('"_id" '"2a0a2ace-9ac68542-984f2174-bc86e685") '('"_wide_channels" $7)))
(let $9 (DqPhyStage '() (lambda '() (block '(
  (let $31 (KqpTable '"/local/test_db/olap_yatests/tpch/s1/lineitem" '"72075186224037897:10" '"" '1))
  (let $32 '('"l_discount" '"l_extendedprice" '"l_partkey" '"l_shipdate"))
  (let $33 (KqpBlockReadOlapTableRanges $31 (Void) $32 '() '() (lambda '($34) (block '(
    (let $35 (StructType $2 $3 $5 '('"l_shipdate" (DataType 'Date32))))
    (let $36 '((KqpOlapApplyColumnArg $35 '"l_shipdate")))
    (let $37 (KqpOlapApply (lambda '($40) (>= $40 (Date '"9374"))) $36 '""))
    (let $38 (KqpOlapApply (lambda '($41) (Coalesce (< $41 (Just (Date '"9404"))) $6)) $36 '""))
    (let $39 '('"l_discount" '"l_extendedprice" '"l_partkey"))
    (return (TKqpOlapExtractMembers (KqpOlapFilter $34 (KqpOlapAnd $37 $38)) $39))
  )))))
  (return (WideFromBlocks (FromFlow $33)))
))) $8))
(let $10 '('('"_logical_id" '4931) '('"_id" '"aa642f10-c0cba553-ab22734d-bab3f995") '('"_wide_channels" (StructType '('"p_partkey" $4) '('"p_type" (DataType 'Utf8))))))
(let $11 (DqPhyStage '() (lambda '() (block '(
  (let $42 (KqpTable '"/local/test_db/olap_yatests/tpch/s1/part" '"72075186224037897:13" '"" '1))
  (let $43 (KqpBlockReadOlapTableRanges $42 (Void) '('"p_partkey" '"p_type") '() '() (lambda '($44) $44)))
  (return (WideFromBlocks (FromFlow $43)))
))) $10))
(let $12 '('2))
(let $13 (DqCnHashShuffle (TDqOutput $9 '0) $12 '1 '"HashV1"))
(let $14 '('0))
(let $15 (DqCnHashShuffle (TDqOutput $11 '0) $14 '1 '"HashV1"))
(let $16 '('('"_logical_id" '3193) '('"_id" '"bb014539-7de7b202-37308941-66a2ced8") '('"_wide_channels" (StructType '('_yql_agg_0 $1) '('_yql_agg_1 $1)))))
(let $17 (DqPhyStage '($13 $15) (lambda '($45 $46) (block '(
  (let $47 '('0 '0 '1 '1))
  (let $48 (GraceJoinCore (ToFlow $45) (ToFlow $46) '"Inner" $12 $14 $47 '('1 '2) '('"l.l_partkey") '('"p.p_partkey") '()))
  (let $49 (lambda '($51 $52 $53) (block '(
    (let $54 (* $52 (- (Int32 '1) $51)))
    (let $55 (If (StartsWith $53 (String '"PROMO")) $54 (Double '"0.")))
    (return $55 $54)
  ))))
  (let $50 (AggBlockApply 'sum $1))
  (return (BlockCombineAll (WideToBlocks (FromFlow (WideMap $48 $49))) (Void) '('($50 '0) '($50 '1))))
))) $16))
(let $18 (DqCnUnionAll (TDqOutput $17 '0)))
(let $19 (OptionalType (StructType '('Sum0 $1) '('Sum1 $1))))
(let $20 (DqPhyStage '($18) (lambda '($56) (block '(
  (let $57 (lambda '($60 $61) $60 $61))
  (let $58 (lambda '($66 $67 $68 $69) (AggrAdd $66 $68) (AggrAdd $67 $69)))
  (let $59 (WideCondense1 (ToFlow $56) $57 (lambda '($62 $63 $64 $65) $6) $58))
  (return (FromFlow (Condense (NarrowMap (Take $59 (Uint64 '1)) (lambda '($70 $71) (AsStruct '('Sum0 $70) '('Sum1 $71)))) (Nothing $19) (lambda '($72 $73) $6) (lambda '($74 $75) (Just $74)))))
))) '('('"_logical_id" '4709) '('"_id" '"394ccc21-4eb648b5-a6e05ad9-301fa3a3"))))
(let $21 '($9 $11 $17 $20))
(let $22 (DqCnValue (TDqOutput $20 '0)))
(let $23 '('('"type" '"generic")))
(let $24 (KqpPhysicalTx $21 '($22) '() $23))
(let $25 '"%kqp%tx_result_binding_0_0")
(let $26 '('('"_logical_id" '4821) '('"_id" '"f08fe516-da59209e-685ce298-ac79c56d") '('"_partition_mode" '"single")))
(let $27 (DqPhyStage '() (lambda '() (block '(
  (let $76 %kqp%tx_result_binding_0_0)
  (return (Iterator (AsList (AsStruct '('"promo_revenue" (/ (* (Double '"100.") (Member $76 'Sum0)) (Member $76 'Sum1)))))))
))) $26))
(let $28 (DqCnResult (TDqOutput $27 '0) '('"promo_revenue")))
(let $29 (KqpTxResultBinding $19 '0 '0))
(let $30 (KqpPhysicalTx '($27) '($28) '('($25 $29)) $23))
(return (KqpPhysicalQuery '($24 $30) '((KqpTxResultBinding (ListType (StructType '('"promo_revenue" (OptionalType $1)))) '1 '0)) '('('"type" '"query"))))
)
