(
(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" '"dd2bb1e1-d4b8b8e2-9abe575e-b24146c1") '('"_partition_mode" '"single")))
(let $8 (DqPhyStage '() (lambda '() (block '(
  (let $30 (Uint64 '10000))
  (let $31 (Int32 '"62"))
  (let $32 (Just $31))
  (let $33 (Int32 '1))
  (let $34 '($32 $33))
  (let $35 (If (== $31 (Int32 '2147483647)) $34 '((+ $32 $33) $1)))
  (let $36 (Nothing $4))
  (let $37 '((Nothing $3) $36 (Nothing $6) $36 $1))
  (return (ToStream (Just '((RangeFinalize (RangeMultiply $30 (RangeUnion (RangeMultiply $30 (RangeCreate (AsList '($34 $35))) (RangeCreate (AsList '($37 $37)))))))))))
))) $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 '('Minute $13))
(let $17 (DataType 'Uint64))
(let $18 '('('"_logical_id" '7667) '('"_id" '"bb0167ad-e1b926ca-f5d0d35c-7bb77289") '('"_wide_channels" (StructType $16 '('_yql_agg_0 $17)))))
(let $19 (DqPhyStage '() (lambda '() (block '(
  (let $38 (KqpTable '"/local/test_db/olap_yatests/clickbench/hits" '"72075186224037897:8" '"" '1))
  (let $39 '('"DontCountHits" '"EventDate" '"EventTime" '"IsRefresh"))
  (let $40 '('('"UsedKeyColumns" '('"CounterID")) '('"ExpectedMaxRanges" '1) '('"PointPrefixLen" '1)))
  (let $41 (KqpBlockReadOlapTableRanges $38 %kqp%tx_result_binding_0_0 $39 '() $40 (lambda '($45) (block '(
    (let $46 '('eq '"IsRefresh" $1))
    (let $47 '('eq '"DontCountHits" $1))
    (let $48 (DataType 'Int16))
    (let $49 (StructType '('"DontCountHits" $48) '('"EventDate" $2) '('"EventTime" $5) '('"IsRefresh" $48)))
    (let $50 '('"EventDate"))
    (let $51 (OptionalType (DataType 'Date)))
    (let $52 (Bool 'false))
    (let $53 (KqpOlapApply $49 $50 '() (lambda '($56) (Coalesce (>= (SafeCast $56 $51) (Date '"15900")) $52))))
    (let $54 (KqpOlapApply $49 $50 '() (lambda '($57) (Coalesce (<= (SafeCast $57 $51) (Date '"15901")) $52))))
    (let $55 (KqpOlapAnd $46 $47 $53 $54))
    (return (TKqpOlapExtractMembers (KqpOlapFilter $45 $55) '('"EventTime")))
  )))))
  (let $42 (lambda '($58 $59) (BlockMember (BlockAsStruct '('"EventTime" $58)) '"EventTime") $59))
  (let $43 (Uint64 '1))
  (let $44 (lambda '($70 $71) $70 $71))
  (return (FromFlow (WideCombiner (ToFlow (WideFromBlocks (FromFlow (WideMap $41 $42)))) '-1073741824 (lambda '($60) (block '(
    (let $61 (OptionalType (DataType 'Timestamp)))
    (let $62 (TupleType (TupleType $61) (StructType) (TupleType)))
    (let $63 (CallableType '() '((OptionalType (DataType 'Uint32))) '($61)))
    (let $64 (Udf '"DateTime2.ToSeconds" (Void) $62 '"" $63 (VoidType) '"" '('('"blocks") '('"strict"))))
    (return (/ (Apply $64 (SafeCast $60 $61)) (Int32 '"60")))
  ))) (lambda '($65 $66) $43) (lambda '($67 $68 $69) (AggrAdd $69 $43)) $44)))
))) $18))
(let $20 (DqCnHashShuffle (TDqOutput $19 '0) '('0)))
(let $21 (Uint64 '10))
(let $22 '('('"_logical_id" '8231) '('"_id" '"30df42e5-fe0779aa-4863aa60-fecc213f") '('"_wide_channels" (StructType '('Count0 $17) $16))))
(let $23 (DqPhyStage '($20) (lambda '($72) (block '(
  (let $73 (lambda '($84 $85) $85 $84))
  (let $74 (WideCombiner (ToFlow $72) '"" (lambda '($75 $76) $75) (lambda '($77 $78 $79) $79) (lambda '($80 $81 $82 $83) (AggrAdd $82 $83)) $73))
  (return (FromFlow (WideTopSort $74 $21 '('('1 (Bool 'true))))))
))) $22))
(let $24 (DqCnMerge (TDqOutput $23 '0) '('('1 '"Asc"))))
(let $25 (DqPhyStage '($24) (lambda '($86) (FromFlow (NarrowMap (Take (ToFlow $86) $21) (lambda '($87 $88) (AsStruct '('Minute $88) '('"PageViews" $87)))))) '('('"_logical_id" '8328) '('"_id" '"ed0e4994-53366360-b2258cf9-2d5c19dc"))))
(let $26 '($19 $23 $25))
(let $27 (DqCnResult (TDqOutput $25 '0) '('Minute '"PageViews")))
(let $28 (KqpTxResultBinding $15 '0 '0))
(let $29 (KqpPhysicalTx $26 '($27) '('($11 $28)) '('('"type" '"generic"))))
(return (KqpPhysicalQuery '($10 $29) '((KqpTxResultBinding (ListType (StructType $16 '('"PageViews" $17))) '1 '0)) '('('"type" '"query"))))
)
