(
(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 '"14") '('DataSize '"614") '('ChunkCount '1) '('ModifyTime '0) '('Revision '0)))
(let $6 (YtTable '"Input" $3 $4 $5 '() (Void) (Void) '"/Root/plato"))
(let $7 (DataType 'String))
(let $8 '('"key" $7))
(let $9 '('('"_logical_id" '3327) '('"_id" '"a5aa51ea-a95f7dee-9ec1ec09-d6b7ddfa") '('"_wide_channels" (StructType $8 '('"subkey" $7)))))
(let $10 (DqPhyStage '() (lambda '() (block '(
  (let $40 (YtReadTable! world $1 '((YtSection '((YtPath $6 '('"key" '"subkey") (Void) (Void))) '()))))
  (let $41 (lambda '($45 $46) $45 $46))
  (let $42 (lambda '($47 $48 $49 $50) $47 $48))
  (let $43 (lambda '($51 $52 $53 $54 $55 $56) $55 $56))
  (let $44 (lambda '($57 $58 $59 $60) $59 $60))
  (return (DqPhyHashCombine (WideToBlocks (FromFlow (DqReadWideWrap $40 '()))) '-1073741824 $41 $42 $43 $44))
))) $9))
(let $11 (DqCnHashShuffle (TDqOutput $10 '0) '('0 '1) '0 '"HashV2"))
(let $12 '('Auto 'Many))
(let $13 (OptionalType $7))
(let $14 '('"key" $13))
(let $15 '('"_wide_channels" (StructType $14)))
(let $16 '('('"_logical_id" '3835) '('"_id" '"8587021a-20b5d8f7-da886017-f4c55de8") $15))
(let $17 (DqPhyStage '($11) (lambda '($61) (block '(
  (let $62 (NarrowSqueezeToDict (ToFlow (WideFromBlocks $61)) (lambda '($64 $65) '($64 $65)) (lambda '($66 $67) (AsStruct '('"key" $66) '('"subkey" $67))) $12))
  (let $63 (Condense1 (OrderedFlatMap $62 (lambda '($68) (OrderedFlatMap (DictPayloads $68) (lambda '($69) $69)))) (lambda '($70) $70) (lambda '($71 $72) (Or (AggrNotEquals (Member $71 '"key") (Member $72 '"key")) (AggrNotEquals (Member $71 '"subkey") (Member $72 '"subkey")))) (lambda '($73 $74) $74)))
  (return (FromFlow (ExpandMap $63 (lambda '($75) (Just (Member $75 '"key"))))))
))) $16))
(let $18 (lambda '($77) $77))
(let $19 '('('"_logical_id" '3372) '('"_id" '"46a4e11f-a9ae3258-3fb6d319-ca2334c5") '('"_wide_channels" (StructType $8))))
(let $20 (DqPhyStage '() (lambda '() (block '(
  (let $76 (YtReadTable! world $1 '((YtSection '((YtPath $6 '('"key") (Void) (Void))) '()))))
  (return (DqPhyHashCombine (WideToBlocks (FromFlow (DqReadWideWrap $76 '()))) '-1073741824 $18 (lambda '($78 $79) $78) (lambda '($80 $81 $82) $82) (lambda '($83 $84) $84)))
))) $19))
(let $21 (DqCnHashShuffle (TDqOutput $20 '0) '('0) '0 '"HashV2"))
(let $22 '('('"_logical_id" '3527) '('"_id" '"5ef46170-b03d3071-7ed82539-bef90415") '('"_partition_mode" '"aggregate") $15))
(let $23 (DqPhyStage '($21) (lambda '($85) (block '(
  (let $86 (NarrowSqueezeToDict (ToFlow (WideFromBlocks $85)) $18 (lambda '($88) (AsStruct '('"key" $88))) $12))
  (let $87 (Condense1 (OrderedFlatMap $86 (lambda '($89) (OrderedFlatMap (DictPayloads $89) (lambda '($90) $90)))) (lambda '($91) (Member $91 '"key")) (lambda '($92 $93) (AggrNotEquals (Member $92 '"key") $93)) (lambda '($94 $95) $95)))
  (return (FromFlow (ExpandMap $87 (lambda '($96) (Just $96)))))
))) $22))
(let $24 '('('"_logical_id" '3874) '('"_id" '"2bdd2a11-3dec206a-df6bf795-94009446") $15))
(let $25 (DqPhyStage '() (lambda '() (FromFlow (ExpandMap (ToFlow (AsList (AsStruct '('"key" (Nothing $13))))) (lambda '($97) (Member $97 '"key"))))) $24))
(let $26 (DqCnParallelUnionAll (TDqOutput $17 '0)))
(let $27 (DqCnParallelUnionAll (TDqOutput $23 '0)))
(let $28 (DqCnParallelUnionAll (TDqOutput $25 '0)))
(let $29 '($26 $27 $28))
(let $30 '('('"_logical_id" '3886) '('"_id" '"d866ebbc-54188502-d8e9f689-104a5a22") $15))
(let $31 (DqPhyStage $29 (lambda '($98 $99 $100) (FromFlow (Extend (ToFlow $98) (ToFlow $99) (ToFlow $100)))) $30))
(let $32 (DqCnUnionAll (TDqOutput $31 '0)))
(let $33 (StructType $14 '('"rn" (DataType 'Uint64))))
(let $34 '('('"_logical_id" '4159) '('"_id" '"23986896-7a96ccd7-ebc97235-dacd2c37") '('"_wide_channels" $33)))
(let $35 (DqPhyStage '($32) (lambda '($101) (block '(
  (let $102 (Bool 'true))
  (let $103 (Chain1Map (NarrowMap (WideSort (ToFlow $101) '('('0 $102))) (lambda '($106) (AsStruct '('"key" $106)))) (lambda '($107) (block '(
    (let $108 '('_yql_RowNumber0 (Uint64 '1)))
    (return '((AsStruct $108 '('"key" (Member $107 '"key"))) (AsStruct $108)))
  ))) (lambda '($109 $110) (block '(
    (let $111 '('_yql_RowNumber0 (Inc (Member (Nth $110 '1) '_yql_RowNumber0))))
    (return '((AsStruct $111 '('"key" (Member $109 '"key"))) (AsStruct $111)))
  )))))
  (let $104 (Sort (Map $103 (lambda '($112) (block '(
    (let $113 (Nth $112 '0))
    (return (AsStruct '('"key" (Member $113 '"key")) '('"rn" (Member $113 '_yql_RowNumber0))))
  )))) $102 (lambda '($114) (Member $114 '"rn"))))
  (let $105 (lambda '($115) (Member $115 '"key") (Member $115 '"rn")))
  (return (FromFlow (ExpandMap $104 $105)))
))) $34))
(let $36 (DqCnMerge (TDqOutput $35 '0) '('('1 '"Asc"))))
(let $37 (DqPhyStage '($36) (lambda '($116) (FromFlow (NarrowMap (ToFlow $116) (lambda '($117 $118) (AsStruct '('"key" $117) '('"rn" $118)))))) '('('"_logical_id" '4171) '('"_id" '"f83bbca9-96f8b70b-dde69a7c-5eaba6a8"))))
(let $38 '($10 $17 $20 $23 $25 $31 $35 $37))
(let $39 (DqCnResult (TDqOutput $37 '0) '('"rn" '"key")))
(return (KqpPhysicalQuery '((KqpPhysicalTx $38 '($39) '() '('('"type" '"generic")))) '((KqpTxResultBinding (ListType $33) '0 '0)) '('('"type" '"query"))))
)
