(
(declare %kqp%tx_result_binding_0_0 (OptionalType (StructType '('Count0 (DataType 'Uint64)))))
(declare %kqp%tx_result_binding_2_0 (OptionalType (StructType '('Count0 (DataType 'Uint64)))))
(let $1 '@@["StructType";[["key";["DataType";"String"]];["subkey";["DataType";"String"]];["value";["DataType";"String"]]]]@@)
(let $2 (YqlRowSpec '('NativeYtTypeFlags '0) '('StrictSchema '1) '('UniqueKeys '0) '('Type $1)))
(let $3 (YtMeta '('CanWrite '1) '('DoesExist '1) '('YqlCompatibleScheme '1) '('InferredScheme '0) '('IsDynamic '0) '('Attrs '('('"native_strict_schema" 'false)))))
(let $4 (YtStat '('Id '"Input2") '('RecordsCount '4) '('DataSize '"164") '('ChunkCount '1) '('ModifyTime '0) '('Revision '0)))
(let $5 (YtTable '"Input2" $2 $3 $4 '() (Void) (Void) '"/Root/plato"))
(let $6 (YtReadTable! world (DataSource '"yt" '"/Root/plato") '((YtSection '((YtPath $5 '('"value") (Void) (Void))) '()))))
(let $7 (DqReadWideWrap $6 '()))
(let $8 (Uint32 '0))
(let $9 (Uint32 '1))
(let $10 (String '"a"))
(let $11 (Uint64 '1))
(let $12 (lambda '($62) $11))
(let $13 (Bool 'false))
(let $14 (lambda '($63 $64) $13))
(let $15 (lambda '($65 $66) (AggrAdd $66 $11)))
(let $16 (lambda '($67) $67))
(let $17 (DataType 'Uint64))
(let $18 '('"_wide_channels" (StructType '('_yql_agg_0 $17))))
(let $19 '('('"_logical_id" '3102) '('"_id" '"7460ce11-b8ddb057-dba309e7-a6737ba7") $18))
(let $20 (DqPhyStage '() (lambda '() (block '(
  (let $58 (Condense1 (NarrowMap (WideFilter $7 (lambda '($59) (block '(
    (let $60 (Substring $59 $8 $9))
    (return (== $60 $10))
  )))) (lambda '($61) (AsStruct))) $12 $14 $15))
  (return (FromFlow (ExpandMap $58 $16)))
))) $19))
(let $21 (DqCnUnionAll (TDqOutput $20 '0)))
(let $22 (lambda '($74) (AsStruct '('Count0 $74))))
(let $23 (OptionalType (StructType '('Count0 $17))))
(let $24 (Nothing $23))
(let $25 (lambda '($75 $76) $13))
(let $26 (lambda '($77 $78) (Just $77)))
(let $27 (DqPhyStage '($21) (lambda '($68) (block '(
  (let $69 (WideCondense1 (ToFlow $68) $16 (lambda '($70 $71) $13) (lambda '($72 $73) (AggrAdd $72 $73))))
  (return (FromFlow (Condense (NarrowMap (Take $69 $11) $22) $24 $25 $26)))
))) '('('"_logical_id" '3743) '('"_id" '"cf31468-fc36c04a-a2606cae-a795f551"))))
(let $28 (DqCnValue (TDqOutput $27 '0)))
(let $29 '('('"type" '"compute")))
(let $30 (KqpPhysicalTx '($20 $27) '($28) '() $29))
(let $31 '"%kqp%tx_result_binding_0_0")
(let $32 (Uint64 '0))
(let $33 '('"_partition_mode" '"single"))
(let $34 '('('"_logical_id" '3863) '('"_id" '"67a7515-3a950b5-daceeac9-76e263e6") $33))
(let $35 (DqPhyStage '() (lambda '() (block '(
  (let $79 (Uint64 '4))
  (return (Iterator (AsList (AsStruct '('"column0" $79) '('"column1" (/ $79 (Just (Coalesce (Member %kqp%tx_result_binding_0_0 'Count0) $32))))))))
))) $34))
(let $36 '('"column0" '"column1"))
(let $37 (DqCnResult (TDqOutput $35 '0) $36))
(let $38 (KqpTxResultBinding $23 '0 '0))
(let $39 '('('"type" '"generic")))
(let $40 (KqpPhysicalTx '($35) '($37) '('($31 $38)) $39))
(let $41 (lambda '($84) $84))
(let $42 '('('"_logical_id" '4092) '('"_id" '"eb13bc2e-d7462139-73dcae09-1e46a4e3") $18))
(let $43 (DqPhyStage '() (lambda '() (block '(
  (let $80 (Condense1 (NarrowMap (WideFilter $7 (lambda '($81) (block '(
    (let $82 (Substring $81 $8 $9))
    (return (== $82 $10))
  )))) (lambda '($83) (AsStruct))) $12 $14 $15))
  (return (FromFlow (ExpandMap $80 $41)))
))) $42))
(let $44 (DqCnUnionAll (TDqOutput $43 '0)))
(let $45 (DqPhyStage '($44) (lambda '($85) (block '(
  (let $86 (WideCondense1 (ToFlow $85) $41 (lambda '($87 $88) $13) (lambda '($89 $90) (AggrAdd $89 $90))))
  (return (FromFlow (Condense (NarrowMap (Take $86 $11) $22) $24 $25 $26)))
))) '('('"_logical_id" '4732) '('"_id" '"3804cee4-65e10583-4afb9ada-89d2be6c"))))
(let $46 (DqCnValue (TDqOutput $45 '0)))
(let $47 (KqpPhysicalTx '($43 $45) '($46) '() $29))
(let $48 '"%kqp%tx_result_binding_2_0")
(let $49 '('('"_logical_id" '4852) '('"_id" '"938b0df3-4fa0f889-4712ea63-43f8aeba") $33))
(let $50 (DqPhyStage '() (lambda '() (block '(
  (let $91 (Uint64 '9))
  (return (Iterator (AsList (AsStruct '('"column0" $91) '('"column1" (/ $91 (Just (Coalesce (Member %kqp%tx_result_binding_2_0 'Count0) $32))))))))
))) $49))
(let $51 (DqCnResult (TDqOutput $50 '0) $36))
(let $52 (KqpTxResultBinding $23 '"2" '0))
(let $53 (KqpPhysicalTx '($50) '($51) '('($48 $52)) $39))
(let $54 '($30 $40 $47 $53))
(let $55 (ListType (StructType '('"column0" $17) '('"column1" (OptionalType $17)))))
(let $56 (KqpTxResultBinding $55 '1 '0))
(let $57 (KqpTxResultBinding $55 '"3" '0))
(return (KqpPhysicalQuery $54 '($56 $57) '('('"type" '"query"))))
)
