(
(let $1 (DataType 'String))
(let $2 (lambda '($44 $45 $46) (AsStruct '('_yql_agg_0 $44) '('_yql_agg_1 $45) '('"key" $46))))
(let $3 (OptionalType $1))
(let $4 (OptionalType (DataType 'Int64)))
(let $5 '('"key" $3))
(let $6 (StructType '('_yql_agg_0 $3) '('_yql_agg_1 $4) $5))
(let $7 '('('"_logical_id" '1747) '('"_id" '"dca8d0d4-5013de32-9970d3c1-929c52b9") '('"_wide_channels" $6)))
(let $8 (DqPhyStage '() (lambda '() (block '(
  (let $18 '@@["StructType";[["key";["OptionalType";["DataType";"String"]]]]]@@)
  (let $19 (YqlRowSpec '('NativeYtTypeFlags '0) '('StrictSchema '0) '('UniqueKeys '0) '('Type $18)))
  (let $20 (YtMeta '('CanWrite '1) '('DoesExist '1) '('YqlCompatibleScheme '0) '('InferredScheme '1) '('IsDynamic '0) '('Attrs '('('"native_strict_schema" '"false")))))
  (let $21 (YtStat '('Id '"Input") '('RecordsCount '"3") '('DataSize '"95") '('ChunkCount '1) '('ModifyTime '0) '('Revision '0)))
  (let $22 (YtTable '"Input" $19 $20 $21 '() (Void) (Void) '"/Root/plato"))
  (let $23 (YtReadTable! world (DataSource '"yt" '"/Root/plato") '((YtSection '((YtPath $22 '('"_other" '"key") (Void) (Void))) '()))))
  (let $24 (Nothing (OptionalType (DictType $1 (DataType 'Yson)))))
  (let $25 (CombineCore (NarrowMap (DqReadWideWrap $23 '()) (lambda '($27 $28) (AsStruct '('"_other" $27) '('"key" $28)))) (lambda '($29) (Member $29 '"key")) (lambda '($30 $31) (block '(
    (let $32 (Just (Member $31 '"_other")))
    (let $33 (TryWeakMemberFromDict $32 $24 'String '"value"))
    (let $34 (TryWeakMemberFromDict $32 $24 'Int64 '"subkey"))
    (return (AsStruct '('_yql_agg_0 $33) '('_yql_agg_1 $34)))
  ))) (lambda '($35 $36 $37) (block '(
    (let $38 (Just (Member $36 '"_other")))
    (let $39 (TryWeakMemberFromDict $38 $24 'String '"value"))
    (let $40 (TryWeakMemberFromDict $38 $24 'Int64 '"subkey"))
    (return (AsStruct '('_yql_agg_0 (AggrMax $39 (Member $37 '_yql_agg_0))) '('_yql_agg_1 (AggrMin $40 (Member $37 '_yql_agg_1)))))
  ))) (lambda '($41 $42) (Just (AsStruct '('_yql_agg_0 (Member $42 '_yql_agg_0)) '('_yql_agg_1 (Member $42 '_yql_agg_1)) '('"key" $41)))) '0))
  (let $26 (lambda '($43) (Member $43 '_yql_agg_0) (Member $43 '_yql_agg_1) (Member $43 '"key")))
  (return (FromFlow (ExpandMap (NarrowMap (ExpandMap $25 $26) $2) $26)))
))) $7))
(let $9 (DqCnHashShuffle (TDqOutput $8 '0) '('"2") '0 '"HashV2"))
(let $10 (StructType '('"column1" $4) '('"column2" $3) $5))
(let $11 '('('"_logical_id" '2006) '('"_id" '"8249aa6c-b94cda35-bf5b5cef-9373e24f") '('"_wide_channels" $10)))
(let $12 (DqPhyStage '($9) (lambda '($47) (block '(
  (let $48 (SqueezeToDict (NarrowMap (ToFlow $47) $2) (lambda '($52) (Member $52 '"key")) (lambda '($53) $53) '('Auto 'Many)))
  (let $49 (Condense1 (AssumeChopped (OrderedFlatMap $48 (lambda '($54) (OrderedFlatMap (DictPayloads $54) (lambda '($55) $55)))) '('"key")) (lambda '($56) $56) (lambda '($57 $58) (AggrNotEquals (Member $57 '"key") (Member $58 '"key"))) (lambda '($59 $60) (AsStruct '('_yql_agg_0 (AggrMax (Member $59 '_yql_agg_0) (Member $60 '_yql_agg_0))) '('_yql_agg_1 (AggrMin (Member $59 '_yql_agg_1) (Member $60 '_yql_agg_1))) '('"key" (Member $60 '"key"))))))
  (let $50 (Sort (Map $49 (lambda '($61) (AsStruct '('"column1" (Member $61 '_yql_agg_1)) '('"column2" (Member $61 '_yql_agg_0)) '('"key" (Member $61 '"key"))))) (Bool 'true) (lambda '($62) (Member $62 '"key"))))
  (let $51 (lambda '($63) (Member $63 '"column1") (Member $63 '"column2") (Member $63 '"key")))
  (return (FromFlow (ExpandMap $50 $51)))
))) $11))
(let $13 (DqCnMerge (TDqOutput $12 '0) '('('"2" '"Asc"))))
(let $14 (DqPhyStage '($13) (lambda '($64) (FromFlow (NarrowMap (ToFlow $64) (lambda '($65 $66 $67) (AsStruct '('"column1" $65) '('"column2" $66) '('"key" $67)))))) '('('"_logical_id" '2018) '('"_id" '"39675bd0-e43fcedb-562572bf-1c6bc895"))))
(let $15 '($8 $12 $14))
(let $16 '('"key" '"column1" '"column2"))
(let $17 (DqCnResult (TDqOutput $14 '0) $16))
(return (KqpPhysicalQuery '((KqpPhysicalTx $15 '($17) '() '('('"type" '"generic")))) '((KqpTxResultBinding (ListType $10) '0 '0)) '('('"type" '"query"))))
)
