(
(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 '('RecordsCount '"4"))
(let $6 '('DataSize '"166"))
(let $7 '('ChunkCount '1))
(let $8 '('ModifyTime '0))
(let $9 '('Revision '0))
(let $10 '('"key" '"subkey"))
(let $11 (DataType 'String))
(let $12 '('"_wide_channels" (StructType '('"key" $11) '('"subkey" $11))))
(let $13 '('('"_logical_id" '5326) '('"_id" '"d7efee02-28f21302-f4d639c6-2f8986e") $12))
(let $14 (DqPhyStage '() (lambda '() (block '(
  (let $37 (YtStat '('Id '"Input1") $5 $6 $7 $8 $9))
  (let $38 (YtTable '"Input1" $3 $4 $37 '() (Void) (Void) '"/Root/plato"))
  (let $39 (YtReadTable! world $1 '((YtSection '((YtPath $38 $10 (Void) (Void))) '()))))
  (return (FromFlow (DqReadWideWrap $39 '())))
))) $13))
(let $15 (DqCnUnionAll (TDqOutput $14 '0)))
(let $16 (lambda '($40) $40))
(let $17 '('('"_logical_id" '5402) '('"_id" '"1e08dc48-437ab604-d82bb112-bc9b3823") $12))
(let $18 (DqPhyStage '($15) $16 $17))
(let $19 '('('"_logical_id" '5349) '('"_id" '"3dde4224-a9d0af93-1bc4ca24-f4494acd") $12))
(let $20 (DqPhyStage '() (lambda '() (block '(
  (let $41 (YtStat '('Id '"Input2") $5 $6 $7 $8 $9))
  (let $42 (YtTable '"Input2" $3 $4 $41 '() (Void) (Void) '"/Root/plato"))
  (let $43 (YtReadTable! world $1 '((YtSection '((YtPath $42 $10 (Void) (Void))) '()))))
  (return (FromFlow (DqReadWideWrap $43 '())))
))) $19))
(let $21 (DqCnUnionAll (TDqOutput $20 '0)))
(let $22 '('('"_logical_id" '5389) '('"_id" '"66a651c4-d954e9d4-837a4b48-818019e3") $12))
(let $23 (DqPhyStage '($21) $16 $22))
(let $24 '('0))
(let $25 (DqCnHashShuffle (TDqOutput $18 '0) $24 '0 '"HashV2"))
(let $26 (DqCnHashShuffle (TDqOutput $23 '0) $24 '0 '"HashV2"))
(let $27 (OptionalType $11))
(let $28 (OptionalType (DataType 'Int32)))
(let $29 (StructType '('"a.subkey" $27) '('"akey" $27) '('"b.subkey" $27) '('"b.value" $28) '('"bkey" $27)))
(let $30 '('('"_logical_id" '5559) '('"_id" '"5ec1b7c3-4997fea3-b94ccb24-910cc8bb") '('"_wide_channels" $29)))
(let $31 (DqPhyStage '($25 $26) (lambda '($44 $45) (block '(
  (let $46 (lambda '($52 $53) $52))
  (let $47 (lambda '($54 $55) (AsStruct '('"key" $54) '('"subkey" $55))))
  (let $48 '('Many 'Hashed 'Compact))
  (let $49 (NarrowSqueezeToDict (ToFlow $44) $46 $47 $48))
  (let $50 (Sort (Map (FlatMap $49 (lambda '($56) (block '(
    (let $57 (NarrowSqueezeToDict (ToFlow $45) $46 $47 $48))
    (return (FlatMap $57 (lambda '($58) (block '(
      (let $59 (JoinDict $56 $58 'Exclusion '()))
      (return (Map $59 (lambda '($60) (block '(
        (let $61 (Nth $60 '0))
        (let $62 (Nth $60 '1))
        (return (AsStruct '('"a.key" (Member $61 '"key")) '('"a.subkey" (Member $61 '"subkey")) '('"b.key" (Member $62 '"key")) '('"b.subkey" (Member $62 '"subkey"))))
      )))))
    )))))
  )))) (lambda '($63) (block '(
    (let $64 (Member $63 '"a.key"))
    (let $65 (Nothing $27))
    (let $66 (IfPresent (FilterNullMembers (AssumeAllMembersNullableAtOnce (Just (AsStruct '('"key" $64) '('"subkey" (Member $63 '"a.subkey"))))) $10) (lambda '($70) (Just (Concat (Member $70 '"subkey") (Member $70 '"key")))) $65))
    (let $67 (Member $63 '"b.key"))
    (let $68 (IfPresent (FilterNullMembers (AssumeAllMembersNullableAtOnce (Just (AsStruct '('"key" $67) '('"subkey" (Member $63 '"b.subkey"))))) $10) (lambda '($71) (Just (Concat (Member $71 '"key") (Member $71 '"subkey")))) $65))
    (let $69 (If (Exists $67) (Just (Int32 '1)) (Nothing $28)))
    (return (AsStruct '('"a.subkey" $66) '('"akey" $64) '('"b.subkey" $68) '('"b.value" $69) '('"bkey" $67)))
  )))) (Bool 'true) (lambda '($72) (Member $72 '"akey"))))
  (let $51 (lambda '($73) (Member $73 '"a.subkey") (Member $73 '"akey") (Member $73 '"b.subkey") (Member $73 '"b.value") (Member $73 '"bkey")))
  (return (FromFlow (ExpandMap $50 $51)))
))) $30))
(let $32 (DqCnMerge (TDqOutput $31 '0) '('('1 '"Asc"))))
(let $33 (DqPhyStage '($32) (lambda '($74) (FromFlow (NarrowMap (ToFlow $74) (lambda '($75 $76 $77 $78 $79) (AsStruct '('"a.subkey" $75) '('"akey" $76) '('"b.subkey" $77) '('"b.value" $78) '('"bkey" $79)))))) '('('"_logical_id" '5571) '('"_id" '"61a7cb60-d6cefa41-3edb7a75-cc09a2e7"))))
(let $34 '($14 $18 $20 $23 $31 $33))
(let $35 '('"akey" '"bkey" '"a.subkey" '"b.subkey" '"b.value"))
(let $36 (DqCnResult (TDqOutput $33 '0) $35))
(return (KqpPhysicalQuery '((KqpPhysicalTx $34 '($36) '() '('('"type" '"generic")))) '((KqpTxResultBinding (ListType $29) '0 '0)) '('('"type" '"query"))))
)
