(
(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 (OptionalType (DataType 'Int64)))
(let $5 (OptionalType (DataType 'Timestamp64)))
(let $6 '('('"_logical_id" '8260) '('"_id" '"33e26be1-55529047-ecb1a18d-6d9dfd31") '('"_partition_mode" '"single")))
(let $7 (DqPhyStage '() (lambda '() (block '(
  (let $37 (Uint64 '10000))
  (let $38 (Int32 '1))
  (let $39 '((Just (Int32 '"62")) $38))
  (let $40 '((Nothing $2) $3))
  (let $41 (RangeMultiply $37 (RangeCreate (AsList '($39 $39))) (RangeIntersect (RangeCreate (AsList '('((Just (SafeCast (Date '"15887") $1)) $38) $40))) (RangeCreate (AsList '($40 '((Just (SafeCast (Date '"15917") $1)) $38)))))))
  (let $42 (Nothing $4))
  (let $43 '($42 (Nothing $5) $42 $3))
  (return (ToStream (Just '((RangeFinalize (RangeMultiply $37 (RangeUnion (RangeMultiply $37 $41 (RangeCreate (AsList '($43 $43)))))))))))
))) $6))
(let $8 (DqCnValue (TDqOutput $7 '0)))
(let $9 (KqpPhysicalTx '($7) '($8) '() '('('"type" '"compute"))))
(let $10 '"%kqp%tx_result_binding_0_0")
(let $11 (DataType 'Int32))
(let $12 (TupleType (OptionalType $11) $2 $4 $5 $4 $11))
(let $13 (TupleType (ListType (TupleType $12 $12))))
(let $14 '('0 '1 '"2" '"3" '"4"))
(let $15 (DataType 'Int16))
(let $16 '('"AdvEngineID" $15))
(let $17 '('Dst (DataType 'Utf8)))
(let $18 '('"SearchEngineID" $15))
(let $19 '('Src (DataType 'String)))
(let $20 '('"TraficSourceID" $15))
(let $21 (DataType 'Uint64))
(let $22 (StructType $16 $17 $18 $19 $20 '('_yql_agg_0 $21)))
(let $23 '('('"_logical_id" '8668) '('"_id" '"2234e3a2-7caf0d69-4081811a-2d88ad5a") '('"_wide_channels" $22)))
(let $24 (DqPhyStage '() (lambda '() (block '(
  (let $44 (KqpTable '"/local/test_db/olap_yatests/clickbench/hits" '"72075186224037897:8" '"" '1))
  (let $45 '('"AdvEngineID" '"IsRefresh" '"Referer" '"SearchEngineID" '"TraficSourceID" '"URL"))
  (let $46 '('('"UsedKeyColumns" '('"CounterID" '"EventDate")) '('"ExpectedMaxRanges" '1) '('"PointPrefixLen" '1)))
  (let $47 (KqpBlockReadOlapTableRanges $44 %kqp%tx_result_binding_0_0 $45 '() $46 (lambda '($49) (block '(
    (let $50 '('eq '"IsRefresh" $3))
    (let $51 '('"AdvEngineID" '"Referer" '"SearchEngineID" '"TraficSourceID" '"URL"))
    (return (TKqpOlapExtractMembers (KqpOlapFilter $49 $50) $51))
  )))))
  (let $48 (lambda '($52 $53 $54 $55 $56) (block '(
    (let $57 (If (And (== $54 $3) (== $52 $3)) (ToString $53) (String '"")))
    (return $52 $56 $54 $57 $55)
  ))))
  (return (BlockCombineHashed (WideToBlocks (FromFlow (WideMap (ToFlow (WideFromBlocks (FromFlow $47))) $48))) (Void) $14 '('((AggBlockApply 'count_all)))))
))) $23))
(let $25 (DqCnHashShuffle (TDqOutput $24 '0) $14 '0 '"HashV1"))
(let $26 (Uint64 '10))
(let $27 (StructType $16 '('Count0 $21) $17 $18 $19 $20))
(let $28 '('('"_logical_id" '9408) '('"_id" '"5a0080a9-3be01d61-f61a2733-d66b9ae3") '('"_wide_channels" $27)))
(let $29 (DqPhyStage '($25) (lambda '($58) (block '(
  (let $59 (AggBlockApplyState 'count_all $21 $21))
  (let $60 (WideTopSort (ToFlow (WideFromBlocks (BlockMergeFinalizeHashed $58 $14 '('($59 '5))))) $26 '('('5 (Bool 'false)))))
  (let $61 (lambda '($62 $63 $64 $65 $66 $67) $62 $67 $63 $64 $65 $66))
  (return (FromFlow (WideMap $60 $61)))
))) $28))
(let $30 (DqCnMerge (TDqOutput $29 '0) '('('1 '"Desc"))))
(let $31 (DqPhyStage '($30) (lambda '($68) (FromFlow (NarrowMap (Take (ToFlow $68) $26) (lambda '($69 $70 $71 $72 $73 $74) (AsStruct '('"AdvEngineID" $69) '('Dst $71) '('"PageViews" $70) '('"SearchEngineID" $72) '('Src $73) '('"TraficSourceID" $74)))))) '('('"_logical_id" '9539) '('"_id" '"6f857145-46b814d5-4225d26c-7ecba1c7"))))
(let $32 '($24 $29 $31))
(let $33 '('"TraficSourceID" '"SearchEngineID" '"AdvEngineID" 'Src 'Dst '"PageViews"))
(let $34 (DqCnResult (TDqOutput $31 '0) $33))
(let $35 (KqpTxResultBinding $13 '0 '0))
(let $36 (KqpPhysicalTx $32 '($34) '('($10 $35)) '('('"type" '"generic"))))
(return (KqpPhysicalQuery '($9 $36) '((KqpTxResultBinding (ListType (StructType $16 $17 '('"PageViews" $21) $18 $19 $20)) '1 '0)) '('('"type" '"query"))))
)
