(
(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" '"b5e121f3-266c4db2-f829dfad-b088434a") '('"_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 (DataType 'Int16))
(let $15 '('"AdvEngineID" $14))
(let $16 '('Dst (DataType 'Utf8)))
(let $17 '('"SearchEngineID" $14))
(let $18 '('Src (DataType 'String)))
(let $19 '('"TraficSourceID" $14))
(let $20 (DataType 'Uint64))
(let $21 (StructType $15 $16 $17 $18 $19 '('_yql_agg_0 $20)))
(let $22 '('('"_logical_id" '8654) '('"_id" '"b999d308-148e41a9-26a02069-42c3cfd3") '('"_wide_channels" $21)))
(let $23 (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 '($52) (block '(
    (let $53 '('eq '"IsRefresh" $3))
    (let $54 '('"AdvEngineID" '"Referer" '"SearchEngineID" '"TraficSourceID" '"URL"))
    (return (TKqpOlapExtractMembers (KqpOlapFilter $52 $53) $54))
  )))))
  (let $48 (lambda '($55 $56 $57 $58 $59 $60) (block '(
    (let $61 (BlockAsStruct '('"AdvEngineID" $55) '('"Referer" $56) '('"SearchEngineID" $57) '('"TraficSourceID" $58) '('"URL" $59)))
    (let $62 (BlockMember $61 '"AdvEngineID"))
    (let $63 (BlockMember $61 '"SearchEngineID"))
    (let $64 (BlockType (DataType 'Bool)))
    (let $65 (AsScalar $3))
    (let $66 (BlockFunc '"Equals" $64 $63 $65))
    (let $67 (BlockFunc '"Equals" $64 $62 $65))
    (return $62 (BlockMember $61 '"URL") $63 (BlockAnd $66 $67) (BlockMember $61 '"Referer") (BlockMember $61 '"TraficSourceID") $60)
  ))))
  (let $49 (lambda '($68 $69 $70 $71 $72 $73) (block '(
    (let $74 (If $71 (ToString $72) (String '"")))
    (return $68 $69 $70 $74 $73)
  ))))
  (let $50 (Uint64 '1))
  (let $51 (lambda '($98 $99 $100 $101 $102 $103) $98 $99 $100 $101 $102 $103))
  (return (FromFlow (WideCombiner (ToFlow (WideFromBlocks (FromFlow (WideMap $47 $48)))) '-1073741824 $49 (lambda '($75 $76 $77 $78 $79 $80 $81 $82 $83 $84 $85) $50) (lambda '($86 $87 $88 $89 $90 $91 $92 $93 $94 $95 $96 $97) (AggrAdd $97 $50)) $51)))
))) $22))
(let $24 '('0 '1 '2 '3 '4))
(let $25 (DqCnHashShuffle (TDqOutput $23 '0) $24))
(let $26 (Uint64 '10))
(let $27 (StructType $15 '('Count0 $20) $16 $17 $18 $19))
(let $28 '('('"_logical_id" '9375) '('"_id" '"56c4e0ce-8610d8ee-d61063b5-7120af9e") '('"_wide_channels" $27)))
(let $29 (DqPhyStage '($25) (lambda '($104) (block '(
  (let $105 (lambda '($108 $109 $110 $111 $112 $113) $108 $109 $110 $111 $112))
  (let $106 (lambda '($137 $138 $139 $140 $141 $142) $137 $142 $138 $139 $140 $141))
  (let $107 (WideCombiner (ToFlow $104) '"" $105 (lambda '($114 $115 $116 $117 $118 $119 $120 $121 $122 $123 $124) $124) (lambda '($125 $126 $127 $128 $129 $130 $131 $132 $133 $134 $135 $136) (AggrAdd $135 $136)) $106))
  (return (FromFlow (WideTopSort $107 $26 '('('1 (Bool 'false))))))
))) $28))
(let $30 (DqCnMerge (TDqOutput $29 '0) '('('1 '"Desc"))))
(let $31 (DqPhyStage '($30) (lambda '($143) (FromFlow (NarrowMap (Take (ToFlow $143) $26) (lambda '($144 $145 $146 $147 $148 $149) (AsStruct '('"AdvEngineID" $144) '('Dst $146) '('"PageViews" $145) '('"SearchEngineID" $147) '('Src $148) '('"TraficSourceID" $149)))))) '('('"_logical_id" '9488) '('"_id" '"c27b9f85-afe6f694-6c3d0b9c-140cfb6c"))))
(let $32 '($23 $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 $15 $16 '('"PageViews" $20) $17 $18 $19)) '1 '0)) '('('"type" '"query"))))
)
