(
(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) '('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))) '()))))
(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" '8335) '('"_id" '"ba62a6dd-7eda6f9b-fe643518-6557c32") $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" '8629) '('"_id" '"8021d34-92f601d9-8bda3fa1-ef27bc5d"))))
(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))) '()))))
(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" '8698) '('"_id" '"74bb717a-c6b0630e-297881ca-9fe911bd"))))
(let $33 (DqCnUnionAll (TDqOutput $32 '0)))
(let $34 (DqPhyStage '($33) (lambda '($79) $79) '('('"_logical_id" '10068) '('"_id" '"bcbd146-21bed6f5-876c5677-1e62487b"))))
(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" '8862) '('"_id" '"4a470f10-17e4a252-43c2b88f-d91364d0") $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" '9152) '('"_id" '"9e5f2e5d-992f228-3c4a676-f450193e"))))
(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" '9221) '('"_id" '"9e7976ac-bf8b901f-6ba162c4-6e1f3c89"))))
(let $48 (DqCnUnionAll (TDqOutput $47 '0)))
(let $49 (DqPhyStage '($48) (lambda '($89) $89) '('('"_logical_id" '10979) '('"_id" '"89f55c38-121140d4-91058c99-35716f1"))))
(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"))))
)
