(
(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" '"bdbf4d26-25fe5bfe-49f760ed-9dff20ae") '('"_partition_mode" '"single")))
(let $8 (DqPhyStage '() (lambda '() (block '(
  (let $33 (Uint64 '10000))
  (let $34 (Int32 '1))
  (let $35 '((Just (Int32 '"62")) $34))
  (let $36 '((Nothing $2) $3))
  (let $37 (RangeMultiply $33 (RangeCreate (AsList '($35 $35))) (RangeIntersect (RangeCreate (AsList '('((Just (SafeCast (Date '"15887") $1)) $34) $36))) (RangeCreate (AsList '($36 '((Just (SafeCast (Date '"15917") $1)) $34)))))))
  (let $38 (Nothing $5))
  (let $39 '($38 (Nothing $6) $38 $3))
  (return (ToStream (Just '((RangeFinalize (RangeMultiply $33 (RangeUnion (RangeMultiply $33 $37 (RangeCreate (AsList '($39 $39)))))))))))
))) $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" '3964) '('"_id" '"ed3fff4d-d93344ed-9e28d674-8058b6e6") '('"_wide_channels" $18)))
(let $20 (DqPhyStage '() (lambda '() (block '(
  (let $40 (KqpTable '"/local/test_db/olap_yatests/clickbench/hits" '"72075186224037897:8" '"" '1))
  (let $41 '('"EventDate" '"IsRefresh" '"RefererHash" '"TraficSourceID" '"URLHash"))
  (let $42 '('('"UsedKeyColumns" '('"CounterID" '"EventDate")) '('"ExpectedMaxRanges" '1) '('"PointPrefixLen" '1)))
  (let $43 (KqpBlockReadOlapTableRanges $40 %kqp%tx_result_binding_0_0 $41 '() $42 (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))
  )))))
  (let $44 (lambda '($52 $53 $54 $55) (block '(
    (let $56 (BlockAsStruct '('"EventDate" $52) '('"URLHash" $53) '('_yql_agg_0 $54)))
    (return (BlockMember $56 '"EventDate") (BlockMember $56 '"URLHash") (BlockMember $56 '_yql_agg_0) $55)
  ))))
  (return (FromFlow (WideMap $43 $44)))
))) $19))
(let $21 (DqCnHashShuffle (TDqOutput $20 '0) '('0 '1)))
(let $22 (Uint64 '10))
(let $23 (StructType '('Count0 $17) $15 $16))
(let $24 '('('"_logical_id" '4372) '('"_id" '"b4cc35c8-c5135e75-61fc9b9e-50345e8b") '('"_wide_channels" $23)))
(let $25 (DqPhyStage '($21) (lambda '($57) (block '(
  (let $58 (lambda '($61 $62 $63) $61 $62))
  (let $59 (lambda '($75 $76 $77) $77 $75 $76))
  (let $60 (WideCombiner (ToFlow (WideFromBlocks $57)) '"" $58 (lambda '($64 $65 $66 $67 $68) $68) (lambda '($69 $70 $71 $72 $73 $74) (AggrAdd $73 $74)) $59))
  (return (FromFlow (WideTopSort $60 $22 '('('0 (Bool 'false))))))
))) $24))
(let $26 (DqCnMerge (TDqOutput $25 '0) '('('0 '"Desc"))))
(let $27 (DqPhyStage '($26) (lambda '($78) (FromFlow (NarrowMap (Take (ToFlow $78) $22) (lambda '($79 $80 $81) (AsStruct '('"EventDate" $80) '('"PageViews" $79) '('"URLHash" $81)))))) '('('"_logical_id" '4473) '('"_id" '"f041cb3a-afeefff6-a7917966-238d7659"))))
(let $28 '($20 $25 $27))
(let $29 '('"URLHash" '"EventDate" '"PageViews"))
(let $30 (DqCnResult (TDqOutput $27 '0) $29))
(let $31 (KqpTxResultBinding $14 '0 '0))
(let $32 (KqpPhysicalTx $28 '($30) '('($11 $31)) '('('"type" '"generic"))))
(return (KqpPhysicalQuery '($10 $32) '((KqpTxResultBinding (ListType (StructType $15 '('"PageViews" $17) $16)) '1 '0)) '('('"type" '"query"))))
)
