(
(declare %kqp%tx_result_binding_0_0 (TupleType (ListType (TupleType (TupleType (OptionalType (DataType 'Int32)) (OptionalType (DataType 'Date32)) (OptionalType (DataType 'Int64)) (OptionalType (DataType 'Timestamp64)) (OptionalType (DataType 'Int64)) (DataType 'Int32)) (TupleType (OptionalType (DataType 'Int32)) (OptionalType (DataType 'Date32)) (OptionalType (DataType 'Int64)) (OptionalType (DataType 'Timestamp64)) (OptionalType (DataType 'Int64)) (DataType 'Int32))))))
(let $1 (Int32 '0))
(let $2 (DataType 'Date32))
(let $3 (OptionalType $2))
(let $4 (OptionalType (DataType 'Int64)))
(let $5 (DataType 'Timestamp64))
(let $6 (OptionalType $5))
(let $7 '('('"_logical_id" '7273) '('"_id" '"d494bc3-e2080be3-eecf5091-dee6df31") '('"_partition_mode" '"single")))
(let $8 (DqPhyStage '() (lambda '() (block '(
  (let $31 (Uint64 '10000))
  (let $32 (Int32 '"62"))
  (let $33 (Just $32))
  (let $34 (Int32 '1))
  (let $35 '($33 $34))
  (let $36 (If (== $32 (Int32 '2147483647)) $35 '((+ $33 $34) $1)))
  (let $37 (Nothing $4))
  (let $38 '((Nothing $3) $37 (Nothing $6) $37 $1))
  (return (ToStream (Just '((RangeFinalize (RangeMultiply $31 (RangeUnion (RangeMultiply $31 (RangeCreate (AsList '($35 $36))) (RangeCreate (AsList '($38 $38)))))))))))
))) $7))
(let $9 (DqCnValue (TDqOutput $8 '0)))
(let $10 (KqpPhysicalTx '($8) '($9) '() '('('"type" '"compute"))))
(let $11 '"%kqp%tx_result_binding_0_0")
(let $12 (DataType 'Int32))
(let $13 (OptionalType $12))
(let $14 (TupleType $13 $3 $4 $6 $4 $12))
(let $15 (TupleType (ListType (TupleType $14 $14))))
(let $16 '('0))
(let $17 '('Minute $13))
(let $18 (DataType 'Uint64))
(let $19 '('('"_logical_id" '7874) '('"_id" '"d6c30e24-6f7ac947-760ef615-30472881") '('"_wide_channels" (StructType $17 '('_yql_agg_0 $18)))))
(let $20 (DqPhyStage '() (lambda '() (block '(
  (let $39 (KqpTable '"/local/test_db/olap_yatests/clickbench/hits" '"72075186224037897:8" '"" '1))
  (let $40 '('"DontCountHits" '"EventDate" '"EventTime" '"IsRefresh"))
  (let $41 '('('"UsedKeyColumns" '('"CounterID")) '('"ExpectedMaxRanges" '1) '('"PointPrefixLen" '1)))
  (let $42 (KqpBlockReadOlapTableRanges $39 %kqp%tx_result_binding_0_0 $40 '() $41 (lambda '($43) (block '(
    (let $44 '('eq '"IsRefresh" $1))
    (let $45 '('eq '"DontCountHits" $1))
    (let $46 (OptionalType (DataType 'Date)))
    (let $47 (Bool 'false))
    (let $48 (DataType 'Int16))
    (let $49 (StructType '('"DontCountHits" $48) '('"EventDate" $2) '('"EventTime" $5) '('"IsRefresh" $48)))
    (let $50 '((KqpOlapApplyColumnArg $49 '"EventDate")))
    (let $51 (KqpOlapApply (lambda '($54) (Coalesce (>= (SafeCast $54 $46) (Date '"15900")) $47)) $50 '""))
    (let $52 (KqpOlapApply (lambda '($55) (Coalesce (<= (SafeCast $55 $46) (Date '"15901")) $47)) $50 '""))
    (let $53 (KqpOlapAnd $44 $45 $51 $52))
    (return (TKqpOlapExtractMembers (KqpOlapFilter $43 $53) '('"EventTime")))
  )))))
  (return (BlockCombineHashed (WideToBlocks (FromFlow (WideMap (ToFlow (WideFromBlocks (FromFlow $42))) (lambda '($56) (block '(
    (let $57 (OptionalType (DataType 'Timestamp)))
    (let $58 (TupleType (TupleType $57) (StructType) (TupleType)))
    (let $59 (CallableType '() '((OptionalType (DataType 'Uint32))) '($57)))
    (let $60 (Udf '"DateTime2.ToSeconds" (Void) $58 '"" $59 (VoidType) '"" '('('"blocks") '('"strict"))))
    (return (/ (Apply $60 (SafeCast $56 $57)) (Int32 '"60")))
  )))))) (Void) $16 '('((AggBlockApply 'count_all)))))
))) $19))
(let $21 (DqCnHashShuffle (TDqOutput $20 '0) $16 '0 '"HashV1"))
(let $22 (Uint64 '10))
(let $23 '('('"_logical_id" '8470) '('"_id" '"dd076b67-6143a17b-8544d36b-96ca4e28") '('"_wide_channels" (StructType '('Count0 $18) $17))))
(let $24 (DqPhyStage '($21) (lambda '($61) (block '(
  (let $62 (AggBlockApplyState 'count_all $18 $18))
  (let $63 (WideTopSort (ToFlow (WideFromBlocks (BlockMergeFinalizeHashed $61 $16 '('($62 '1))))) $22 '('('0 (Bool 'true)))))
  (let $64 (lambda '($65 $66) $66 $65))
  (return (FromFlow (WideMap $63 $64)))
))) $23))
(let $25 (DqCnMerge (TDqOutput $24 '0) '('('1 '"Asc"))))
(let $26 (DqPhyStage '($25) (lambda '($67) (FromFlow (NarrowMap (Take (ToFlow $67) $22) (lambda '($68 $69) (AsStruct '('Minute $69) '('"PageViews" $68)))))) '('('"_logical_id" '8585) '('"_id" '"ed78b0f0-9536fa72-93f6259d-7d8efe03"))))
(let $27 '($20 $24 $26))
(let $28 (DqCnResult (TDqOutput $26 '0) '('Minute '"PageViews")))
(let $29 (KqpTxResultBinding $15 '0 '0))
(let $30 (KqpPhysicalTx $27 '($28) '('($11 $29)) '('('"type" '"generic"))))
(return (KqpPhysicalQuery '($10 $30) '((KqpTxResultBinding (ListType (StructType $17 '('"PageViews" $18))) '1 '0)) '('('"type" '"query"))))
)
