(
(let $1 (Configure! world (DataSource '"config") '"DqEngine" '"force"))
(let $2 (Configure! $1 (DataSource '"dq" '"$all") '"Attr" '"maxtasksperstage" '"2"))
(let $3 (Configure! $2 (DataSource '"pq" '"$all") '"Attr" '"consumer" '"test_client"))
(let $4 (DataSource '"pq" '"pq"))
(let $5 '('('"PartitionsCount" '"1")))
(let $6 (DataType 'String))
(let $7 (StructType '('"Data" $6)))
(let $8 (PqTopic '"pq" '"local" '"test_topic_input" $5 '() $7))
(let $9 '('"Endpoint" '"<pq_pq_endpoint>"))
(let $10 '('"SharedReading" '"1"))
(let $11 '('"UseSsl" '"1"))
(let $12 '('('"Consumer" '"test_client") $9 $10 '('"ReconnectPeriod" '"") '('"Format" '"raw") '('"ReadGroup" '"fqrun") $11))
(let $13 (SecureParam '"cluster:default_pq"))
(let $14 (DqPqTopicSource $3 $8 '('"Data") $12 $13 '"" $7 '""))
(let $15 (ResourceType '"Yson2.Node"))
(let $16 '('"strict"))
(let $17 '($16))
(let $18 (DataType 'Yson))
(let $19 '($15 '"" '"1"))
(let $20 (CallableType '() '($18) $19))
(let $21 (DataType 'Uint64))
(let $22 (OptionalType $21))
(let $23 '($15))
(let $24 (OptionalType (DataType 'Int64)))
(let $25 (DqStage '((DqSource $4 $14)) (lambda '($29) (block '(
  (let $30 '('('"format" '"raw") '('"formatSettings" '('('"data.datetime.formatname" '"POSIX") '('"data.timestamp.formatname" '"POSIX"))) '('"settings" '($10))))
  (let $31 (DqSourceWideWrap $29 $4 $7 $30))
  (return (FlatMap (NarrowMap $31 (lambda '($32) (AsStruct '('"Data" $32)))) (lambda '($33) (block '(
    (let $34 (ResourceType '"Yson2.Options"))
    (let $35 (TupleType (TupleType $6 $34) (StructType) (TupleType)))
    (let $36 '('"1"))
    (let $37 '($6 '"" '"1"))
    (let $38 '((OptionalType $34)))
    (let $39 (CallableType $36 '((OptionalType $15)) $37 $38))
    (let $40 (Udf '"Yson2.Parse" (Void) $35 '"" $39 (VoidType) '"" '()))
    (let $41 (OptionalType (DataType 'Bool)))
    (let $42 (CallableType '('"2") '($34) '($41 '"AutoConvert") '($41 '"Strict")))
    (let $43 (Udf '"Yson2.Options" (Void) (VoidType) '"" $42 (VoidType) '"" $17))
    (let $44 (Just (NamedApply $43 '() (AsStruct '('"AutoConvert" (Just (Bool '"false"))) '('"Strict" (Just (Bool 'true)))))))
    (let $45 (Apply $40 (Member $33 '"Data") $44))
    (let $46 (FlatMap $45 (lambda '($52) (block '(
      (let $53 (Udf '"Yson2.Serialize" (Void) (VoidType) '"" $20 (VoidType) '"" $17))
      (return (Just (Apply $53 $52)))
    )))))
    (let $47 '($6))
    (let $48 (TupleType (TupleType $18) (StructType) (TupleType)))
    (let $49 '($18 '"" '"1"))
    (let $50 (CallableType $36 $23 $49 $38))
    (let $51 (Udf '"Yson2.Parse" (Void) $48 '"" $50 (VoidType) '"" $17))
    (return (Just (AsStruct '('"t" (FlatMap $46 (lambda '($54) (block '(
      (let $55 (CallableType $36 '($22) $19 $47 $38))
      (let $56 (Udf '"Yson2.LookupUint64" (Void) (VoidType) '"" $55 (VoidType) '"" '()))
      (return (Apply $56 (Apply $51 $54) (String '"time") $44))
    ))))) '('"v" (FlatMap $46 (lambda '($57) (block '(
      (let $58 (CallableType $36 '($24) $19 $47 $38))
      (let $59 (Udf '"Yson2.LookupInt64" (Void) (VoidType) '"" $58 (VoidType) '"" '()))
      (return (Apply $59 (Apply $51 $57) (String '"val") $44))
    ))))))))
  )))))
))) '('('"_logical_id" '0))))
(let $26 (DataSink '"pq" '"pq"))
(let $27 (PqTopic '"pq" '"local" '"test_topic_output" $5 '() $7))
(let $28 (DqPqTopicSink $27 '($9 $11) $13))
(return (Commit! (DqQuery! $3 '((DqStage '((DqCnUnionAll (TDqOutput $25 '0))) (lambda '($60) (block '(
  (let $61 (Interval '10000))
  (let $62 (lambda '($73) $73))
  (let $63 (MultiHoppingCore (FromFlow $60) (lambda '($64) (Uint32 '0)) (lambda '($65) (FlatMap (SafeCast (Unwrap (Member (SafeCast $65 (StructType '('"t" $22))) '"t")) (OptionalType (DataType 'Uint32))) (lambda '($66) (block '(
    (let $67 '($21 '"" '"1"))
    (let $68 (CallableType '() '((OptionalType (DataType 'Timestamp))) $67))
    (let $69 (Udf '"DateTime2.FromMilliseconds" (Void) (VoidType) '"" $68 (VoidType) '"" '('('"blocks") $16)))
    (return (Apply $69 (Convert $66 $21)))
  ))))) (Interval '5000) $61 $61 'true (lambda '($70) (AsStruct '('Sum0 (Member $70 '"v")))) (lambda '($71 $72) (AsStruct '('Sum0 (AggrAdd (Member $71 '"v") (Member $72 'Sum0))))) $62 $62 (lambda '($74 $75) (AsStruct '('Sum0 (AggrAdd (Member $74 'Sum0) (Member $75 'Sum0))))) (lambda '($76 $77 $78) (AsStruct '('Sum0 (Member $77 'Sum0)) '('"_yql_time" $78))) '0 '"_yql_time"))
  (return (FlatMap (ExtractMembers $63 '('Sum0)) (lambda '($79) (block '(
    (let $80 (Udf '"Yson2.SerializeText" (Void) (VoidType) '"" $20 (VoidType) '"" $17))
    (let $81 (StructType '('"sum" $24)))
    (let $82 (TupleType (TupleType $81) (StructType) (TupleType)))
    (let $83 (CallableType '() $23 '($81)))
    (let $84 (Udf '"Yson2.From" (Void) $82 '"" $83 (VoidType) '"" $17))
    (return (Just (AsStruct '('"column0" (Apply $80 (Apply $84 (AsStruct '('"sum" (Member $79 'Sum0)))))))))
  )))))
))) '('('"_logical_id" '0)) '((DqSink '0 $26 $28))))) $26))
)
