(
(let $1 (OptionalType (DataType 'Int32)))
(let $2 '('"value" (DataType 'String)))
(let $3 (StructType '('"key_hundred" $1) '('"struct" (StructType '('"key" $1) '('"subkey" $1))) $2))
(let $4 '('('"_logical_id" '4880) '('"_id" '"63a229fc-ea8b21ad-c3077a9e-43d9fab0") '('"_wide_channels" $3)))
(let $5 (DqPhyStage '() (lambda '() (block '(
  (let $15 '@@["StructType";[["key";["DataType";"String"]];["subkey";["DataType";"String"]];["value";["DataType";"String"]]]]@@)
  (let $16 (YqlRowSpec '('NativeYtTypeFlags '0) '('StrictSchema '1) '('UniqueKeys '0) '('Type $15)))
  (let $17 (YtMeta '('CanWrite '1) '('DoesExist '1) '('YqlCompatibleScheme '1) '('InferredScheme '0) '('IsDynamic '0) '('Attrs '('('"native_strict_schema" '"false")))))
  (let $18 (YtStat '('Id '"Input") '('RecordsCount '"4") '('DataSize '"166") '('ChunkCount '1) '('ModifyTime '0) '('Revision '0)))
  (let $19 (YtTable '"Input" $16 $17 $18 '() (Void) (Void) '"/Root/plato"))
  (let $20 '('"key" '"subkey" '"value"))
  (let $21 (YtReadTable! world (DataSource '"yt" '"/Root/plato") '((YtSection '((YtPath $19 $20 (Void) (Void))) '()))))
  (let $22 (lambda '($23 $24 $25) (block '(
    (let $26 (SafeCast $23 $1))
    (return (/ $26 (Int32 '"100")) (AsStruct '('"key" $26) '('"subkey" (SafeCast $24 $1))) $25)
  ))))
  (return (FromFlow (WideMap (DqReadWideWrap $21 '()) $22)))
))) $4))
(let $6 (DqCnHashShuffle (TDqOutput $5 '0) '('0) '0 '"HashV2"))
(let $7 (StructType '('"a_part" $1) '('"keyDiff" $1) $2))
(let $8 '('('"_logical_id" '5822) '('"_id" '"9591ae2c-7ea6c4e-c1458547-2459d411") '('"_wide_channels" $7)))
(let $9 (DqPhyStage '($6) (lambda '($27) (block '(
  (let $28 (NarrowSqueezeToDict (ToFlow $27) (lambda '($34 $35 $36) $34) (lambda '($37 $38 $39) (AsStruct '('"key_hundred" $37) '('"struct" $38) '('"value" $39))) '('Auto 'Many)))
  (let $29 (Bool 'true))
  (let $30 '($29 $29))
  (let $31 (Chopper (OrderedFlatMap $28 (lambda '($40) (OrderedFlatMap (DictPayloads $40) (lambda '($41) (Sort $41 $30 (lambda '($42) '((Member (Member $42 '"struct") '"key") (Member $42 '"value")))))))) (lambda '($43) (Member $43 '"key_hundred")) (lambda '($44 $45) (AggrNotEquals $44 (Member $45 '"key_hundred"))) (lambda '($46 $47) (block '(
    (let $48 (FromFlow $47))
    (let $49 (QueueCreate $3 (Uint64 '"3") (Uint64 '0) (DependsOn $48)))
    (let $50 (Uint64 '1))
    (let $51 (lambda '($58) (Member (Member $58 '"struct") '"key")))
    (let $52 (Nothing $1))
    (let $53 (Chain1Map (ToFlow (PreserveStream $48 $49 $50)) (lambda '($54) (block '(
      (let $55 (QueuePeek $49 $50 (DependsOn $54)))
      (let $56 (IfPresent $55 $51 $52))
      (let $57 (AsStruct '('_yql_Lead0 $56) '('"key_hundred" (Member $54 '"key_hundred")) '('"struct" (Member $54 '"struct")) '('"value" (Member $54 '"value"))))
      (return '($57 (AsStruct '('_yql_Lead0 (Void)))))
    ))) (lambda '($59 $60) (block '(
      (let $61 (QueuePeek $49 $50 (DependsOn $59)))
      (let $62 (IfPresent $61 $51 $52))
      (let $63 (AsStruct '('_yql_Lead0 $62) '('"key_hundred" (Member $59 '"key_hundred")) '('"struct" (Member $59 '"struct")) '('"value" (Member $59 '"value"))))
      (return '($63 (Nth $60 '1)))
    )))))
    (return (OrderedMap $53 (lambda '($64) (Nth $64 '0))))
  )))))
  (let $32 (Sort (Map $31 (lambda '($65) (AsStruct '('"a_part" (Member $65 '"key_hundred")) '('"keyDiff" (- (Member (Member $65 '"struct") '"key") (Member $65 '_yql_Lead0))) '('"value" (Member $65 '"value"))))) $30 (lambda '($66) '((Member $66 '"a_part") (Member $66 '"value")))))
  (let $33 (lambda '($67) (Member $67 '"a_part") (Member $67 '"keyDiff") (Member $67 '"value")))
  (return (FromFlow (ExpandMap $32 $33)))
))) $8))
(let $10 (DqCnMerge (TDqOutput $9 '0) '('('0 '"Asc") '('"2" '"Asc"))))
(let $11 (DqPhyStage '($10) (lambda '($68) (FromFlow (NarrowMap (ToFlow $68) (lambda '($69 $70 $71) (AsStruct '('"a_part" $69) '('"keyDiff" $70) '('"value" $71)))))) '('('"_logical_id" '5834) '('"_id" '"a06275d7-43899dfa-341d83b4-4a958682"))))
(let $12 '($5 $9 $11))
(let $13 '('"a_part" '"keyDiff" '"value"))
(let $14 (DqCnResult (TDqOutput $11 '0) $13))
(return (KqpPhysicalQuery '((KqpPhysicalTx $12 '($14) '() '('('"type" '"generic")))) '((KqpTxResultBinding (ListType $7) '0 '0)) '('('"type" '"query"))))
)
