(
(let $1 (Configure! world (DataSource '"config") '"DqEngine" '"force"))
(let $2 (DataSource '"dq" '"$all"))
(let $3 (Configure! $1 $2 '"Attr" '"maxtasksperstage" '"2"))
(let $4 (Configure! $3 $2 '"Attr" '"watermarksmode" '"default"))
(let $5 (Configure! $4 $2 '"Attr" '"computeactortype" '"async"))
(let $6 (Configure! $5 (DataSource '"pq" '"$all") '"Attr" '"consumer" '"test_client"))
(let $7 (DataSource '"pq" '"pq"))
(let $8 '('('"PartitionsCount" '"1")))
(let $9 (DataType 'Uint64))
(let $10 (OptionalType $9))
(let $11 '('"t" $10))
(let $12 (StructType $11 '('"v" $10)))
(let $13 (PqTopic '"pq" '"local" '"test_topic_input" $8 '() $12))
(let $14 '('"Endpoint" '"<pq_pq_endpoint>"))
(let $15 '('"SharedReading" '"1"))
(let $16 '('"UseSsl" '"1"))
(let $17 '('('"Consumer" '"test_client") $14 $15 '('"ReconnectPeriod" '"") '('"Format" '"json_each_row") '('"ReadGroup" '"fqrun") $16 '('"WatermarksEnable" '"1") '('"WatermarksGranularityUs" '"1000000") '('"WatermarksLateArrivalDelayUs" '"5000000") '('"WatermarksLateEventsPolicy" '"adjust")))
(let $18 (SecureParam '"cluster:default_pq"))
(let $19 (DqPqTopicSource $6 $13 '('"t" '"v") $17 $18 '"" $12 '""))
(let $20 (DqStage '((DqSource $7 $19)) (lambda '($24) (block '(
  (let $25 '('('"format" '"json_each_row") '('"formatSettings" '('('"data.datetime.formatname" '"POSIX") '('"data.timestamp.formatname" '"POSIX"))) '('"settings" '($15))))
  (let $26 (DqSourceWideWrap $24 $7 $12 $25))
  (return (NarrowMap $26 (lambda '($27 $28) (AsStruct '('"t" $27) '('"v" $28)))))
))) '('('"_logical_id" '0))))
(let $21 (DataSink '"pq" '"pq"))
(let $22 (PqTopic '"pq" '"local" '"test_topic_output" $8 '() (StructType '('"Data" (DataType 'String)))))
(let $23 (DqPqTopicSink $22 '($14 $16) $18))
(return (Commit! (DqQuery! $6 '((DqStage '((DqCnUnionAll (TDqOutput $20 '0))) (lambda '($29) (block '(
  (let $30 '('"strict"))
  (let $31 (lambda '($42) $42))
  (let $32 (MultiHoppingCore (FromFlow $29) (lambda '($33) (Uint32 '0)) (lambda '($34) (FlatMap (Member (SafeCast $34 (StructType $11)) '"t") (lambda '($35) (block '(
    (let $36 '($9 '"" '"1"))
    (let $37 (CallableType '() '((OptionalType (DataType 'Timestamp))) $36))
    (let $38 (Udf '"DateTime2.FromMilliseconds" (Void) (VoidType) '"" $37 (VoidType) '"" '('('"blocks") $30)))
    (return (Apply $38 $35))
  ))))) (Interval '"5000") (Interval '"10000") (Interval '"5000000") 'true (lambda '($39) (AsStruct '('Sum0 (Member $39 '"v")))) (lambda '($40 $41) (AsStruct '('Sum0 (AggrAdd (Member $40 '"v") (Member $41 'Sum0))))) $31 $31 (lambda '($43 $44) (AsStruct '('Sum0 (AggrAdd (Member $43 'Sum0) (Member $44 'Sum0))))) (lambda '($45 $46 $47) (AsStruct '('Sum0 (Member $46 'Sum0)) '('"group0" $47))) '"1" '"group0"))
  (return (FlatMap (ExtractMembers $32 '('Sum0)) (lambda '($48) (block '(
    (let $49 (ResourceType '"Yson2.Node"))
    (let $50 '($49 '"" '"1"))
    (let $51 (CallableType '() '((DataType 'Yson)) $50))
    (let $52 '($30))
    (let $53 (Udf '"Yson2.SerializeText" (Void) (VoidType) '"" $51 (VoidType) '"" $52))
    (let $54 (StructType '('"sum" $10)))
    (let $55 (TupleType (TupleType $54) (StructType) (TupleType)))
    (let $56 (CallableType '() '($49) '($54)))
    (let $57 (Udf '"Yson2.From" (Void) $55 '"" $56 (VoidType) '"" $52))
    (return (Just (AsStruct '('"column0" (Apply $53 (Apply $57 (AsStruct '('"sum" (Member $48 'Sum0)))))))))
  )))))
))) '('('"_logical_id" '0)) '((DqSink '0 $21 $23))))) $21))
)
