(
(let $1 (DataType 'String))
(let $2 (OptionalType $1))
(let $3 '('"key" $2))
(let $4 '('"subkey" $1))
(let $5 '('"value" $1))
(let $6 (StructType $3 $4 $5))
(let $7 '('"_wide_channels" $6))
(let $8 '('('"_logical_id" '4092) '('"_id" '"2e99531-4c686931-3d9c0052-cd7f63ec") $7))
(let $9 (DqPhyStage '() (lambda '() (block '(
  (let $25 '@@["StructType";[["key";["DataType";"String"]];["subkey";["DataType";"String"]];["value";["DataType";"String"]]]]@@)
  (let $26 (YqlRowSpec '('NativeYtTypeFlags '0) '('StrictSchema '1) '('UniqueKeys '0) '('Type $25)))
  (let $27 (YtMeta '('CanWrite '1) '('DoesExist '1) '('YqlCompatibleScheme '1) '('InferredScheme '0) '('IsDynamic '0) '('HasRLS '0) '('Attrs '('('"native_strict_schema" '"false")))))
  (let $28 (YtStat '('Id '"Input") '('RecordsCount '"30") '('DataSize '"1170") '('ChunkCount '1) '('ModifyTime '0) '('Revision '0)))
  (let $29 (YtTable '"Input" $26 $27 $28 '() (Void) (Void) '"/Root/plato"))
  (let $30 '('"key" '"subkey" '"value"))
  (let $31 (YtReadTable! world (DataSource '"yt" '"/Root/plato") '((YtSection '((YtPath $29 $30 (Void) (Void) (Void))) '()))))
  (let $32 (lambda '($36 $37 $38) (Just $36) $37 $38))
  (return (FromFlow (WideMap (WideFilter (DqReadWideWrap $31 '()) (lambda '($33 $34 $35) (== $33 (String '1)))) $32)))
))) $8))
(let $10 '('('"_logical_id" '4129) '('"_id" '"b20dcd95-3847d13e-e59805bf-deb69d4") $7))
(let $11 (DqPhyStage '() (lambda '() (block '(
  (let $39 '('"subkey" (String '"9")))
  (let $40 (lambda '($41) (Nothing $2) (Member $41 '"subkey") (Member $41 '"value")))
  (return (FromFlow (ExpandMap (ToFlow (AsList (AsStruct $39 '('"value" (String '"000"))) (AsStruct $39 '('"value" (String '"001"))))) $40)))
))) $10))
(let $12 (DqCnParallelUnionAll (TDqOutput $9 '0)))
(let $13 (DqCnParallelUnionAll (TDqOutput $11 '0)))
(let $14 '('('"_logical_id" '4141) '('"_id" '"68d71db8-bfe4feac-c1042b15-feb3e909") $7))
(let $15 (DqPhyStage '($12 $13) (lambda '($42 $43) (FromFlow (Extend (ToFlow $42) (ToFlow $43)))) $14))
(let $16 (DqCnHashShuffle (TDqOutput $15 '0) '('0 '1) '0 '"HashV2"))
(let $17 (StructType '('"agglist1" (ListType $1)) $3 $4 $5))
(let $18 '('('"_logical_id" '4758) '('"_id" '"2f401f3-76db2e2-2a31cbbb-803c2673") '('"_wide_channels" $17)))
(let $19 (DqPhyStage '($16) (lambda '($44) (block '(
  (let $45 (NarrowSqueezeToDict (ToFlow $44) (lambda '($50 $51 $52) '($50 $51)) (lambda '($53 $54 $55) (AsStruct '('"key" $53) '('"subkey" $54) '('"value" $55))) '('Auto 'Many)))
  (let $46 (Bool 'true))
  (let $47 (Chopper (OrderedFlatMap $45 (lambda '($56) (OrderedFlatMap (DictPayloads $56) (lambda '($57) (Sort $57 $46 (lambda '($58) (Member $58 '"value"))))))) (lambda '($59) '((Member $59 '"key") (Member $59 '"subkey"))) (lambda '($60 $61) (Or (AggrNotEquals (Nth $60 '0) (Member $61 '"key")) (AggrNotEquals (Nth $60 '1) (Member $61 '"subkey")))) (lambda '($62 $63) (block '(
    (let $64 (FromFlow $63))
    (let $65 (QueueCreate $6 (Void) (Uint64 '0) (DependsOn $64)))
    (let $66 (Uint64 '"18446744073709551615"))
    (let $67 (Chain1Map (ToFlow (PreserveStream $64 $65 $66)) (lambda '($68) (block '(
      (let $69 (QueueRange $65 (Uint64 '1) $66 (DependsOn $68)))
      (let $70 (Member $68 '"value"))
      (let $71 (Fold (FlatMap $69 (lambda '($74) $74)) (AsList $70) (lambda '($75 $76) (Insert $76 (Member $75 '"value")))))
      (let $72 '('"agglist1" $71))
      (let $73 (AsStruct $72 '('"key" (Member $68 '"key")) '('"subkey" (Member $68 '"subkey")) '('"value" $70)))
      (return '($73 (AsStruct $72)))
    ))) (lambda '($77 $78) (block '(
      (let $79 (Nth $78 '1))
      (let $80 (AsStruct '('"agglist1" (Member $79 '"agglist1")) '('"key" (Member $77 '"key")) '('"subkey" (Member $77 '"subkey")) '('"value" (Member $77 '"value"))))
      (return '($80 $79))
    )))))
    (return (OrderedMap $67 (lambda '($81) (Nth $81 '0))))
  )))))
  (let $48 (Sort $47 $46 (lambda '($82) (Member $82 '"value"))))
  (let $49 (lambda '($83) (Member $83 '"agglist1") (Member $83 '"key") (Member $83 '"subkey") (Member $83 '"value")))
  (return (FromFlow (ExpandMap $48 $49)))
))) $18))
(let $20 (DqCnMerge (TDqOutput $19 '0) '('('"3" '"Asc"))))
(let $21 (DqPhyStage '($20) (lambda '($84) (FromFlow (NarrowMap (ToFlow $84) (lambda '($85 $86 $87 $88) (AsStruct '('"agglist1" $85) '('"key" $86) '('"subkey" $87) '('"value" $88)))))) '('('"_logical_id" '4770) '('"_id" '"f54ea499-55a27b1c-714a152c-2c1afc66"))))
(let $22 '($9 $11 $15 $19 $21))
(let $23 '('"key" '"subkey" '"value" '"agglist1"))
(let $24 (DqCnResult (TDqOutput $21 '0) $23))
(return (KqpPhysicalQuery '((KqpPhysicalTx $22 '($24) '() '('('"type" '"generic")))) '((KqpTxResultBinding (ListType $17) '0 '0)) '('('"type" '"query"))))
)
