(
(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 (DataType 'Date32))
(let $2 (OptionalType $1))
(let $3 (Int32 '0))
(let $4 (DataType 'Int64))
(let $5 (OptionalType $4))
(let $6 (OptionalType (DataType 'Timestamp64)))
(let $7 '('('"_logical_id" '3656) '('"_id" '"f624af72-b3152ecc-d1d6e2a-96cdcd29") '('"_partition_mode" '"single")))
(let $8 (DqPhyStage '() (lambda '() (block '(
  (let $34 (Uint64 '10000))
  (let $35 (Int32 '1))
  (let $36 '((Just (Int32 '"62")) $35))
  (let $37 '((Nothing $2) $3))
  (let $38 (RangeMultiply $34 (RangeCreate (AsList '($36 $36))) (RangeIntersect (RangeCreate (AsList '('((Just (SafeCast (Date '"15887") $1)) $35) $37))) (RangeCreate (AsList '($37 '((Just (SafeCast (Date '"15917") $1)) $35)))))))
  (let $39 (Nothing $5))
  (let $40 '($39 (Nothing $6) $39 $3))
  (return (ToStream (Just '((RangeFinalize (RangeMultiply $34 (RangeUnion (RangeMultiply $34 $38 (RangeCreate (AsList '($40 $40)))))))))))
))) $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 (TupleType (OptionalType $12) $2 $5 $6 $5 $12))
(let $14 (TupleType (ListType (TupleType $13 $13))))
(let $15 '('"EventDate" $1))
(let $16 '('"URLHash" $4))
(let $17 (DataType 'Uint64))
(let $18 (StructType $15 $16 '('_yql_agg_0 $17)))
(let $19 '('('"_logical_id" '4089) '('"_id" '"ef3bb9f3-1b64b29a-fb4da6a5-b48a1bf2") '('"_wide_channels" $18)))
(let $20 (DqPhyStage '() (lambda '() (block '(
  (let $41 (KqpTable '"/local/test_db/olap_yatests/clickbench/hits" '"72075186224037897:8" '"" '1))
  (let $42 '('"EventDate" '"IsRefresh" '"RefererHash" '"TraficSourceID" '"URLHash"))
  (let $43 '('('"UsedKeyColumns" '('"CounterID" '"EventDate")) '('"ExpectedMaxRanges" '1) '('"PointPrefixLen" '1)))
  (let $44 (KqpBlockReadOlapTableRanges $41 %kqp%tx_result_binding_0_0 $42 '() $43 (lambda '($45) (block '(
    (let $46 '('eq '"IsRefresh" $3))
    (let $47 '('eq '"RefererHash" (Int64 '"3594120000172545465")))
    (let $48 '('eq '"TraficSourceID" (Int32 '"-1")))
    (let $49 '('eq '"TraficSourceID" (Int32 '"6")))
    (let $50 (KqpOlapAnd $46 $47 (KqpOlapOr $48 $49)))
    (let $51 '('"EventDate" '"URLHash"))
    (return (TKqpOlapAgg (TKqpOlapExtractMembers (KqpOlapFilter $45 $50) $51) '('('_yql_agg_0 '"count" '"*")) $51))
  )))))
  (return (FromFlow $44))
))) $19))
(let $21 '('0 '1))
(let $22 (DqCnHashShuffle (TDqOutput $20 '0) $21 '0 '"HashV1"))
(let $23 (Uint64 '10))
(let $24 (StructType '('Count0 $17) $15 $16))
(let $25 '('('"_logical_id" '4575) '('"_id" '"b4d6f374-11e7e550-ae68697b-70604a93") '('"_wide_channels" $24)))
(let $26 (DqPhyStage '($22) (lambda '($52) (block '(
  (let $53 (AggBlockApplyState '"count_all" $17 $17))
  (let $54 (WideTopSort (ToFlow (WideFromBlocks (BlockMergeFinalizeHashed $52 $21 '('($53 '2))))) $23 '('('2 (Bool 'false)))))
  (let $55 (lambda '($56 $57 $58) $58 $56 $57))
  (return (FromFlow (WideMap $54 $55)))
))) $25))
(let $27 (DqCnMerge (TDqOutput $26 '0) '('('0 '"Desc"))))
(let $28 (DqPhyStage '($27) (lambda '($59) (FromFlow (NarrowMap (Take (ToFlow $59) $23) (lambda '($60 $61 $62) (AsStruct '('"EventDate" $61) '('"PageViews" $60) '('"URLHash" $62)))))) '('('"_logical_id" '4694) '('"_id" '"a236b45c-d6748611-3d358e80-71d8f237"))))
(let $29 '($20 $26 $28))
(let $30 '('"URLHash" '"EventDate" '"PageViews"))
(let $31 (DqCnResult (TDqOutput $28 '0) $30))
(let $32 (KqpTxResultBinding $14 '0 '0))
(let $33 (KqpPhysicalTx $29 '($31) '('($11 $32)) '('('"type" '"generic"))))
(return (KqpPhysicalQuery '($10 $33) '((KqpTxResultBinding (ListType (StructType $15 '('"PageViews" $17) $16)) '1 '0)) '('('"type" '"query"))))
)
