(
(let $1 (DataType 'Int64))
(let $2 '('"o_orderkey" $1))
(let $3 (DataType 'Utf8))
(let $4 '('"o_orderpriority" $3))
(let $5 '('('"_logical_id" '1893) '('"_id" '"780e99be-cbcb7a2d-63adba34-111e5fd") '('"_wide_channels" (StructType $2 $4))))
(let $6 (DqPhyStage '() (lambda '() (block '(
  (let $28 (KqpTable '"/local/test_db/olap_yatests/tpch/s1/orders" '"72075186224037897:12" '"" '1))
  (let $29 '('"o_orderdate" '"o_orderkey" '"o_orderpriority"))
  (let $30 (Date '"8582"))
  (let $31 (KqpBlockReadOlapTableRanges $28 (Void) $29 '() '() (lambda '($34) (block '(
    (let $35 (StructType '('"o_orderdate" (DataType 'Date32)) $2 $4))
    (let $36 (KqpOlapApply $35 '('"o_orderdate") '() (lambda '($37) (>= $37 $30))))
    (return (KqpOlapFilter $34 $36))
  )))))
  (let $32 (lambda '($38 $39 $40 $41) (block '(
    (let $42 (BlockAsStruct '('"o_orderdate" $38) '('"o_orderkey" $39) '('"o_orderpriority" $40)))
    (let $43 (DataType 'Date))
    (let $44 (DataType 'Int32))
    (let $45 (TupleType (TupleType $43 $44) (StructType) (TupleType)))
    (let $46 (ResourceType '"DateTime2.TM"))
    (let $47 '($46 '"" '1))
    (let $48 (CallableType '() '((OptionalType $46)) $47 '($44)))
    (let $49 '('"strict"))
    (let $50 (Udf '"DateTime2.ShiftMonths" (Void) $45 '"" $48 (VoidType) '"" '($49)))
    (let $51 (TupleType (TupleType $43) (StructType) (TupleType)))
    (let $52 '($43 '"" '1))
    (let $53 (CallableType '() '($46) $52))
    (let $54 '('('"blocks") $49))
    (let $55 (Udf '"DateTime2.Split" (Void) $51 '"" $53 (VoidType) '"" $54))
    (let $56 (Apply $50 (Apply $55 $30) (Int32 '"3")))
    (let $57 (BlockFunc '"Less" (BlockType (OptionalType (DataType 'Bool))) (BlockMember $42 '"o_orderdate") (AsScalar (IfPresent $56 (lambda '($58) (block '(
      (let $59 (CallableType '() '($43) $47))
      (let $60 (Udf '"DateTime2.MakeDate" (Void) (VoidType) '"" $59 (VoidType) '"" $54))
      (return (Just (Apply $60 $58)))
    ))) (Nothing (OptionalType $43))))))
    (return $42 (BlockCoalesce $57 (AsScalar (Bool 'false))) $41)
  ))))
  (let $33 (lambda '($61 $62) (BlockMember $61 '"o_orderkey") (BlockMember $61 '"o_orderpriority") $62))
  (return (FromFlow (WideMap (BlockCompress (WideMap $31 $32) '1) $33)))
))) $5))
(let $7 '('"_wide_channels" (StructType '('"l_orderkey" $1))))
(let $8 '('('"_logical_id" '2264) '('"_id" '"6d7f75f1-85cdcb61-e994e062-9b8a4b2e") $7))
(let $9 (DqPhyStage '() (lambda '() (block '(
  (let $63 (KqpTable '"/local/test_db/olap_yatests/tpch/s1/lineitem" '"72075186224037897:10" '"" '1))
  (let $64 '('"l_commitdate" '"l_orderkey" '"l_receiptdate"))
  (let $65 (KqpBlockReadOlapTableRanges $63 (Void) $64 '() '() (lambda '($67) (block '(
    (let $68 '('lt '"l_commitdate" '"l_receiptdate"))
    (return (TKqpOlapExtractMembers (KqpOlapFilter $67 $68) '('"l_orderkey")))
  )))))
  (let $66 (lambda '($69 $70) (BlockAsStruct '('"l_orderkey" $69)) $70))
  (return (FromFlow (WideCombiner (ToFlow (WideFromBlocks (FromFlow (WideMap $65 $66)))) '-1073741824 (lambda '($71) (Member $71 '"l_orderkey")) (lambda '($72 $73) $72) (lambda '($74 $75 $76) $76) (lambda '($77 $78) $78))))
))) $8))
(let $10 '('0))
(let $11 (DqCnHashShuffle (TDqOutput $9 '0) $10))
(let $12 '('('"_logical_id" '2526) '('"_id" '"bbd310d2-d4083eb9-94dbafaf-ddfbde0d") '('"_partition_mode" '"aggregate") $7))
(let $13 (DqPhyStage '($11) (lambda '($79) (block '(
  (let $80 (lambda '($82) $82))
  (let $81 (lambda '($83 $84)))
  (return (FromFlow (WideCombiner (ToFlow $79) '"" $80 $81 $81 $80)))
))) $12))
(let $14 (DqCnHashShuffle (TDqOutput $6 '0) $10))
(let $15 (DqCnMap (TDqOutput $13 '0)))
(let $16 (lambda '($95 $96) $96 $95))
(let $17 (DataType 'Uint64))
(let $18 '('('"_logical_id" '2809) '('"_id" '"8b8d2ae2-b777fb14-ea85edee-c517118e") '('"_wide_channels" (StructType '('_yql_agg_0 $17) '('"o.o_orderpriority" $3)))))
(let $19 (DqPhyStage '($14 $15) (lambda '($85 $86) (block '(
  (let $87 (GraceJoinCore (ToFlow (WideFromBlocks $85)) (ToFlow $86) '"Inner" $10 $10 '('1 '0) '() '('"o.o_orderkey") '('"l.l_orderkey") '()))
  (let $88 (Uint64 '1))
  (return (FromFlow (WideCombiner $87 '-1073741824 (lambda '($89) $89) (lambda '($90 $91) $88) (lambda '($92 $93 $94) (AggrAdd $94 $88)) $16)))
))) $18))
(let $20 (DqCnHashShuffle (TDqOutput $19 '0) '('1)))
(let $21 (StructType $4 '('"order_count" $17)))
(let $22 '('('"_logical_id" '3363) '('"_id" '"697c9a79-4636ed95-a249af55-e08df477") '('"_wide_channels" $21)))
(let $23 (DqPhyStage '($20) (lambda '($97) (block '(
  (let $98 (WideCombiner (ToFlow $97) '"" (lambda '($100 $101) $101) (lambda '($102 $103 $104) $103) (lambda '($105 $106 $107 $108) (AggrAdd $106 $108)) $16))
  (let $99 (lambda '($109 $110) $110 $109))
  (return (FromFlow (WideMap (WideSort $98 '('('1 (Bool 'true)))) $99)))
))) $22))
(let $24 (DqCnMerge (TDqOutput $23 '0) '('('0 '"Asc"))))
(let $25 (DqPhyStage '($24) (lambda '($111) (FromFlow (NarrowMap (ToFlow $111) (lambda '($112 $113) (AsStruct '('"o_orderpriority" $112) '('"order_count" $113)))))) '('('"_logical_id" '3375) '('"_id" '"72489dae-7d67fd5c-e78d353f-27785ae1"))))
(let $26 '($6 $9 $13 $19 $23 $25))
(let $27 (DqCnResult (TDqOutput $25 '0) '('"o_orderpriority" '"order_count")))
(return (KqpPhysicalQuery '((KqpPhysicalTx $26 '($27) '() '('('"type" '"generic")))) '((KqpTxResultBinding (ListType $21) '0 '0)) '('('"type" '"query"))))
)
