(
(let $1 (DataType 'String))
(let $2 (lambda '($41) (Member $41 '_yql_agg_0) (Member $41 '_yql_agg_1) (Member $41 'subkey)))
(let $3 (lambda '($42 $43 $44) (AsStruct '('_yql_agg_0 $42) '('_yql_agg_1 $43) '('subkey $44))))
(let $4 (OptionalType $1))
(let $5 '('subkey (OptionalType (DataType 'Int64))))
(let $6 (StructType '('_yql_agg_0 $4) '('_yql_agg_1 $4) $5))
(let $7 '('('"_logical_id" '1365) '('"_id" '"9cbabfe2-d87a2955-2823d81-6484085") '('"_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 '($26 $27) (block '(
    (let $28 (AsStruct '('"_other" $26) '('"key" $27)))
    (let $29 (Member $28 '"_other"))
    (let $30 (TryWeakMemberFromDict (Just $29) $24 'Int64 'subkey))
    (return (AsStruct '('"_other" $29) '('"key" (Member $28 '"key")) '('subkey $30)))
  )))) (lambda '($31) (Member $31 'subkey)) (lambda '($32 $33) (block '(
    (let $34 (TryWeakMemberFromDict (Just (Member $33 '"_other")) $24 'String '"value"))
    (return (AsStruct '('_yql_agg_0 $34) '('_yql_agg_1 (Member $33 '"key"))))
  ))) (lambda '($35 $36 $37) (block '(
    (let $38 (TryWeakMemberFromDict (Just (Member $36 '"_other")) $24 'String '"value"))
    (return (AsStruct '('_yql_agg_0 (AggrMax $38 (Member $37 '_yql_agg_0))) '('_yql_agg_1 (AggrMin (Member $36 '"key") (Member $37 '_yql_agg_1)))))
  ))) (lambda '($39 $40) (Just (AsStruct '('_yql_agg_0 (Member $40 '_yql_agg_0)) '('_yql_agg_1 (Member $40 '_yql_agg_1)) '('subkey $39)))) '0))
  (return (FromFlow (ExpandMap (NarrowMap (ExpandMap $25 $2) $3) $2)))
))) $7))
(let $9 (DqCnHashShuffle (TDqOutput $8 '0) '('"2") '0 '"HashV2"))
(let $10 (StructType '('"column0" $4) '('"column2" $4) $5))
(let $11 '('('"_logical_id" '2434) '('"_id" '"5ba23bb2-452d52a1-5a28793f-bdb724bf") '('"_wide_channels" $10)))
(let $12 (DqPhyStage '($9) (lambda '($45) (block '(
  (let $46 (lambda '($54 $55 $56 $57) $55 $56 $57))
  (let $47 (lambda '($58 $59 $60 $61 $62 $63 $64) (AggrMax $59 $62) (AggrMin $60 $63) $64))
  (let $48 (WideCombiner (ExpandMap (NarrowMap (ToFlow $45) $3) $2) '"" (lambda '($51 $52 $53) $53) $46 $47 $46))
  (let $49 (Sort (NarrowMap $48 (lambda '($65 $66 $67) (block '(
    (let $68 (AsStruct '('Max0 $65) '('Min0 $66) '('subkey $67)))
    (return (AsStruct '('"column0" (Member $68 'Min0)) '('"column2" (Member $68 'Max0)) '('subkey (Member $68 'subkey))))
  )))) (Bool 'true) (lambda '($69) (Member $69 'subkey))))
  (let $50 (lambda '($70) (Member $70 '"column0") (Member $70 '"column2") (Member $70 'subkey)))
  (return (FromFlow (ExpandMap $49 $50)))
))) $11))
(let $13 (DqCnMerge (TDqOutput $12 '0) '('('"2" '"Asc"))))
(let $14 (DqPhyStage '($13) (lambda '($71) (FromFlow (NarrowMap (ToFlow $71) (lambda '($72 $73 $74) (AsStruct '('"column0" $72) '('"column2" $73) '('subkey $74)))))) '('('"_logical_id" '2446) '('"_id" '"35a9a967-be6724ea-8228d7a3-784e8fa"))))
(let $15 '($8 $12 $14))
(let $16 '('"column0" 'subkey '"column2"))
(let $17 (DqCnResult (TDqOutput $14 '0) $16))
(return (KqpPhysicalQuery '((KqpPhysicalTx $15 '($17) '() '('('"type" '"generic")))) '((KqpTxResultBinding (ListType $10) '0 '0)) '('('"type" '"query"))))
)
