(
(declare %kqp%tx_result_binding_0_0 (OptionalType (StructType '('"Min0" (DataType 'String)))))
(declare %kqp%tx_result_binding_2_0 (OptionalType (StructType '('"Min0" (DataType 'String)))))
(let $1 (DataSource '"yt" '"/Root/plato"))
(let $2 '@@["StructType";[["key";["DataType";"String"]];["subkey";["DataType";"String"]];["value";["DataType";"String"]]]]@@)
(let $3 (YqlRowSpec '('NativeYtTypeFlags '0) '('StrictSchema '1) '('UniqueKeys '0) '('Type $2)))
(let $4 (YtMeta '('CanWrite '1) '('DoesExist '1) '('YqlCompatibleScheme '1) '('InferredScheme '0) '('IsDynamic '0) '('HasRLS '0) '('Attrs '('('"native_strict_schema" 'false)))))
(let $5 (YtStat '('Id '"Input") '('RecordsCount '"4") '('DataSize '"166") '('ChunkCount '1) '('ModifyTime '0) '('Revision '0)))
(let $6 (YtTable '"Input" $3 $4 $5 '() (Void) (Void) '"/Root/plato"))
(let $7 (YtReadTable! world $1 '((YtSection '((YtPath $6 '('"key") (Void) (Void) (Void))) '()))))
(let $8 (lambda '($59) (AsStruct '('"key" $59))))
(let $9 (Bool 'false))
(let $10 (lambda '($61 $62) $9))
(let $11 (DataType 'String))
(let $12 '('"_wide_channels" (StructType '('_yql_agg_0 $11))))
(let $13 '('('"_logical_id" '8385) '('"_id" '"5dfa57c1-33b3e9ac-28a8da84-a7fb0391") $12))
(let $14 (DqPhyStage '() (lambda '() (block '(
  (let $57 (String '"foo"))
  (let $58 (Condense1 (NarrowMap (DqReadWideWrap $7 '()) $8) (lambda '($60) (Concat (Member $60 '"key") $57)) $10 (lambda '($63 $64) (AggrMin (Concat (Member $63 '"key") $57) $64))))
  (return (FromFlow (ExpandMap $58 (lambda '($65) $65))))
))) $13))
(let $15 (DqCnUnionAll (TDqOutput $14 '0)))
(let $16 (lambda '($68) (AsStruct '('_yql_agg_0 $68))))
(let $17 (lambda '($69) (Member $69 '_yql_agg_0)))
(let $18 (lambda '($70 $71) $9))
(let $19 (lambda '($72 $73) (AggrMin (Member $72 '_yql_agg_0) $73)))
(let $20 (Uint64 '1))
(let $21 (OptionalType (StructType '('"Min0" $11))))
(let $22 (Nothing $21))
(let $23 (lambda '($75 $76) $9))
(let $24 (lambda '($77 $78) (Just $77)))
(let $25 (DqPhyStage '($15) (lambda '($66) (block '(
  (let $67 (Condense1 (NarrowMap (ToFlow $66) $16) $17 $18 $19))
  (return (FromFlow (Condense (Map (Take $67 $20) (lambda '($74) (AsStruct '('"Min0" $74)))) $22 $23 $24)))
))) '('('"_logical_id" '8679) '('"_id" '"e4ca8a07-c8777f16-689e89d3-6ffc1ead"))))
(let $26 (DqCnValue (TDqOutput $25 '0)))
(let $27 '('('"type" '"compute")))
(let $28 (KqpPhysicalTx '($14 $25) '($26) '() $27))
(let $29 (YtReadTable! world $1 '((YtSection '((YtPath $6 '() (Void) (Void) (Void))) '()))))
(let $30 (String '1))
(let $31 '"%kqp%tx_result_binding_0_0")
(let $32 (DqPhyStage '() (lambda '() (FromFlow (NarrowMap (DqReadWideWrap $29 '()) (lambda '() (AsStruct '('"column0" (Concat $30 (Member %kqp%tx_result_binding_0_0 '"Min0")))))))) '('('"_logical_id" '8748) '('"_id" '"3dfe1c6d-57fb662f-3616e4f8-3c6c95bb"))))
(let $33 (DqCnUnionAll (TDqOutput $32 '0)))
(let $34 (DqPhyStage '($33) (lambda '($79) $79) '('('"_logical_id" '10118) '('"_id" '"d7ac3126-1cb93b9b-ec6059d6-ed99a5be"))))
(let $35 '('"column0"))
(let $36 (DqCnResult (TDqOutput $34 '0) $35))
(let $37 (KqpTxResultBinding $21 '0 '0))
(let $38 '('('"type" '"generic")))
(let $39 (KqpPhysicalTx '($32 $34) '($36) '('($31 $37)) $38))
(let $40 '('('"_logical_id" '8912) '('"_id" '"a04dfefb-decf28ad-536574c1-a50b5974") $12))
(let $41 (DqPhyStage '() (lambda '() (block '(
  (let $80 (String '"bar"))
  (let $81 (Condense1 (NarrowMap (DqReadWideWrap $7 '()) $8) (lambda '($82) (Concat (Member $82 '"key") $80)) $10 (lambda '($83 $84) (AggrMin (Concat (Member $83 '"key") $80) $84))))
  (return (FromFlow (ExpandMap $81 (lambda '($85) $85))))
))) $40))
(let $42 (DqCnUnionAll (TDqOutput $41 '0)))
(let $43 (DqPhyStage '($42) (lambda '($86) (block '(
  (let $87 (Condense1 (NarrowMap (ToFlow $86) $16) $17 $18 $19))
  (return (FromFlow (Condense (Map (Take $87 $20) (lambda '($88) (AsStruct '('"Min0" $88)))) $22 $23 $24)))
))) '('('"_logical_id" '9202) '('"_id" '"acc40c9d-6a5a91a0-619a6a8c-5dc0098e"))))
(let $44 (DqCnValue (TDqOutput $43 '0)))
(let $45 (KqpPhysicalTx '($41 $43) '($44) '() $27))
(let $46 '"%kqp%tx_result_binding_2_0")
(let $47 (DqPhyStage '() (lambda '() (FromFlow (NarrowMap (DqReadWideWrap $29 '()) (lambda '() (AsStruct '('"column0" (Concat $30 (Member %kqp%tx_result_binding_2_0 '"Min0")))))))) '('('"_logical_id" '9271) '('"_id" '"fb55cb0e-b33ea168-c5a18983-6b21df11"))))
(let $48 (DqCnUnionAll (TDqOutput $47 '0)))
(let $49 (DqPhyStage '($48) (lambda '($89) $89) '('('"_logical_id" '11029) '('"_id" '"d822e4c1-2dfbc9e8-62ecc034-8b412d83"))))
(let $50 (DqCnResult (TDqOutput $49 '0) $35))
(let $51 (KqpTxResultBinding $21 '"2" '0))
(let $52 (KqpPhysicalTx '($47 $49) '($50) '('($46 $51)) $38))
(let $53 '($28 $39 $45 $52))
(let $54 (ListType (StructType '('"column0" (OptionalType $11)))))
(let $55 (KqpTxResultBinding $54 '1 '0))
(let $56 (KqpTxResultBinding $54 '"3" '0))
(return (KqpPhysicalQuery $53 '($55 $56) '('('"type" '"query"))))
)
