(
(let $1 (DataType 'Date32))
(let $2 (DataType 'Int64))
(let $3 '('"l_orderkey" $2))
(let $4 '('0))
(let $5 '('"_wide_channels" (StructType $3)))
(let $6 '('('"_logical_id" '2641) '('"_id" '"fbfa7374-517a75bb-70604777-e12f8a5f") $5))
(let $7 (DqPhyStage '() (lambda '() (block '(
  (let $29 (KqpTable '"/local/test_db/olap_yatests/tpch/s1/lineitem" '"72075186224037897:10" '"" '1))
  (let $30 '('"l_commitdate" '"l_orderkey" '"l_receiptdate"))
  (let $31 (KqpBlockReadOlapTableRanges $29 (Void) $30 '() '() (lambda '($32) (block '(
    (let $33 (StructType '('"l_commitdate" $1) $3 '('"l_receiptdate" $1)))
    (let $34 (KqpOlapApply (lambda '($35 $36) (< $35 $36)) '((KqpOlapApplyColumnArg $33 '"l_commitdate") (KqpOlapApplyColumnArg $33 '"l_receiptdate")) '""))
    (return (TKqpOlapExtractMembers (KqpOlapFilter $32 $34) '('"l_orderkey")))
  )))))
  (return (BlockCombineHashed (FromFlow $31) (Void) $4 '()))
))) $6))
(let $8 (DqCnHashShuffle (TDqOutput $7 '0) $4 '0 '"HashV1"))
(let $9 '('('"_logical_id" '2974) '('"_id" '"bc06f53d-576c6118-1d4f74d-5c1645ad") '('"_partition_mode" '"aggregate") $5))
(let $10 (DqPhyStage '($8) (lambda '($37) (WideFromBlocks (BlockMergeFinalizeHashed $37 $4 '()))) $9))
(let $11 '('"o_orderkey" $2))
(let $12 (DataType 'Utf8))
(let $13 '('"o_orderpriority" $12))
(let $14 '('('"_logical_id" '1931) '('"_id" '"ad6a6f74-1275647-572c456a-cb612483") '('"_wide_channels" (StructType $11 $13))))
(let $15 (DqPhyStage '() (lambda '() (block '(
  (let $38 (KqpTable '"/local/test_db/olap_yatests/tpch/s1/orders" '"72075186224037897:12" '"" '1))
  (let $39 '('"o_orderdate" '"o_orderkey" '"o_orderpriority"))
  (let $40 (KqpBlockReadOlapTableRanges $38 (Void) $39 '() '() (lambda '($41) (block '(
    (let $42 (Date '"8582"))
    (let $43 (StructType '('"o_orderdate" $1) $11 $13))
    (let $44 '((KqpOlapApplyColumnArg $43 '"o_orderdate")))
    (let $45 (KqpOlapApply (lambda '($47) (>= $47 $42)) $44 '""))
    (let $46 (KqpOlapApply (lambda '($48) (block '(
      (let $49 (DataType 'Date))
      (let $50 (DataType 'Int32))
      (let $51 (TupleType (TupleType $49 $50) (StructType) (TupleType)))
      (let $52 (ResourceType '"DateTime2.TM"))
      (let $53 '($52 '"" '1))
      (let $54 (CallableType '() '((OptionalType $52)) $53 '($50)))
      (let $55 '('"strict"))
      (let $56 (Udf '"DateTime2.ShiftMonths" (Void) $51 '"" $54 (VoidType) '"" '($55)))
      (let $57 (TupleType (TupleType $49) (StructType) (TupleType)))
      (let $58 '($49 '"" '1))
      (let $59 (CallableType '() '($52) $58))
      (let $60 '('('"blocks") $55))
      (let $61 (Udf '"DateTime2.Split" (Void) $57 '"" $59 (VoidType) '"" $60))
      (let $62 (Apply $56 (Apply $61 $42) (Int32 '"3")))
      (let $63 (IfPresent $62 (lambda '($64) (block '(
        (let $65 (CallableType '() '($49) $53))
        (let $66 (Udf '"DateTime2.MakeDate" (Void) (VoidType) '"" $65 (VoidType) '"" $60))
        (return (Just (Apply $66 $64)))
      ))) (Nothing (OptionalType $49))))
      (return (Coalesce (< $48 $63) (Bool 'false)))
    ))) $44 '""))
    (return (TKqpOlapExtractMembers (KqpOlapFilter $41 (KqpOlapAnd $45 $46)) '('"o_orderkey" '"o_orderpriority")))
  )))))
  (return (WideFromBlocks (FromFlow $40)))
))) $14))
(let $16 (DqCnHashShuffle (TDqOutput $10 '0) $4 '1 '"HashV1"))
(let $17 (DqCnHashShuffle (TDqOutput $15 '0) $4 '1 '"HashV1"))
(let $18 (DataType 'Uint64))
(let $19 '('('"_logical_id" '3265) '('"_id" '"adcd5143-2b0e4206-d810b0c2-6809b69b") '('"_wide_channels" (StructType '('_yql_agg_0 $18) '('"o.o_orderpriority" $12)))))
(let $20 (DqPhyStage '($16 $17) (lambda '($67 $68) (block '(
  (let $69 (lambda '($70 $71 $72) $71 $70 $72))
  (return (FromFlow (WideMap (ToFlow (BlockCombineHashed (WideToBlocks (FromFlow (GraceJoinCore (ToFlow $67) (ToFlow $68) '"Inner" $4 $4 '() '('1 '0) '('"l.l_orderkey") '('"o.o_orderkey") '()))) (Void) $4 '('((AggBlockApply 'count_all))))) $69)))
))) $19))
(let $21 (DqCnHashShuffle (TDqOutput $20 '0) '('1) '0 '"HashV1"))
(let $22 (StructType $13 '('"order_count" $18)))
(let $23 '('('"_logical_id" '3967) '('"_id" '"ab3548cc-86dddc9f-8a322088-acd024a9") '('"_wide_channels" $22)))
(let $24 (DqPhyStage '($21) (lambda '($73) (block '(
  (let $74 (lambda '($76 $77 $78) $77 $76 $78))
  (let $75 (AggBlockApplyState 'count_all $18 $18))
  (return (FromFlow (WideSort (ToFlow (WideFromBlocks (BlockMergeFinalizeHashed (FromFlow (WideMap (ToFlow $73) $74)) $4 '('($75 '1))))) '('('0 (Bool 'true))))))
))) $23))
(let $25 (DqCnMerge (TDqOutput $24 '0) '('('0 '"Asc"))))
(let $26 (DqPhyStage '($25) (lambda '($79) (FromFlow (NarrowMap (ToFlow $79) (lambda '($80 $81) (AsStruct '('"o_orderpriority" $80) '('"order_count" $81)))))) '('('"_logical_id" '3979) '('"_id" '"3d4ef8c3-fa43899b-3bc8960f-6bfa284"))))
(let $27 '($7 $10 $15 $20 $24 $26))
(let $28 (DqCnResult (TDqOutput $26 '0) '('"o_orderpriority" '"order_count")))
(return (KqpPhysicalQuery '((KqpPhysicalTx $27 '($28) '() '('('"type" '"generic")))) '((KqpTxResultBinding (ListType $22) '0 '0)) '('('"type" '"query"))))
)
