(
(let $1 (OptionalType (DataType 'Int64)))
(let $2 (StructType '('_yql_agg_0 $1) '('_yql_agg_1 $1) '('"a" (OptionalType (DataType 'String)))))
(let $3 '('('"_logical_id" '1683) '('"_id" '"1f293860-41b07682-d10aef79-5c1e31e2") '('"_wide_channels" $2)))
(let $4 (DqPhyStage '() (lambda '() (block '(
  (let $13 '@@["StructType";[["a";["OptionalType";["DataType";"String"]]];["b";["OptionalType";["DataType";"Uint64"]]];["c";["OptionalType";["DataType";"Int64"]]];["d";["OptionalType";["DataType";"Int64"]]]]]@@)
  (let $14 (YqlRowSpec '('NativeYtTypeFlags '0) '('StrictSchema '1) '('UniqueKeys '0) '('Type $13)))
  (let $15 (YtMeta '('CanWrite '1) '('DoesExist '1) '('YqlCompatibleScheme '1) '('InferredScheme '0) '('IsDynamic '0) '('Attrs '('('"native_strict_schema" '"false")))))
  (let $16 (YtStat '('Id '"Input") '('RecordsCount '"8") '('DataSize '"296") '('ChunkCount '1) '('ModifyTime '0) '('Revision '0)))
  (let $17 (YtTable '"Input" $14 $15 $16 '() (Void) (Void) '"/Root/plato"))
  (let $18 '('"a" '"c" '"d"))
  (let $19 (YtReadTable! world (DataSource '"yt" '"/Root/plato") '((YtSection '((YtPath $17 $18 (Void) (Void))) '()))))
  (let $20 (lambda '($26 $27 $28 $29) $29 $28))
  (let $21 (lambda '($30 $31 $32 $33 $34 $35) (AggrMax $33 $34) (AggrAdd $32 $35)))
  (let $22 (lambda '($36 $37 $38) $37 $38 $36))
  (return (DqPhyHashCombine (WideToBlocks (FromFlow (DqReadWideWrap $19 '()))) '-1073741824 (lambda '($23 $24 $25) $23) $20 $21 $22))
))) $3))
(let $5 (DqCnHashShuffle (TDqOutput $4 '0) '('"2") '0 '"HashV2"))
(let $6 (StructType '('"maxd" $1) '('"sumc" $1)))
(let $7 '('('"_logical_id" '2042) '('"_id" '"287265b-e71ed544-5aa189e8-b0a96c45") '('"_wide_channels" $6)))
(let $8 (DqPhyStage '($5) (lambda '($39) (block '(
  (let $40 (NarrowSqueezeToDict (ToFlow (WideFromBlocks $39)) (lambda '($45 $46 $47) $47) (lambda '($48 $49 $50) (AsStruct '('_yql_agg_0 $48) '('_yql_agg_1 $49) '('"a" $50))) '('Auto 'Many)))
  (let $41 (Condense1 (OrderedFlatMap $40 (lambda '($51) (OrderedFlatMap (DictPayloads $51) (lambda '($52) $52)))) (lambda '($53) $53) (lambda '($54 $55) (AggrNotEquals (Member $54 '"a") (Member $55 '"a"))) (lambda '($56 $57) (AsStruct '('_yql_agg_0 (AggrMax (Member $56 '_yql_agg_0) (Member $57 '_yql_agg_0))) '('_yql_agg_1 (AggrAdd (Member $56 '_yql_agg_1) (Member $57 '_yql_agg_1))) '('"a" (Member $57 '"a"))))))
  (let $42 (Bool 'true))
  (let $43 (Sort (Map $41 (lambda '($58) (AsStruct '('"maxd" (Member $58 '_yql_agg_0)) '('"sumc" (Member $58 '_yql_agg_1))))) '($42 $42) (lambda '($59) '((Member $59 '"sumc") (Member $59 '"maxd")))))
  (let $44 (lambda '($60) (Member $60 '"maxd") (Member $60 '"sumc")))
  (return (FromFlow (ExpandMap $43 $44)))
))) $7))
(let $9 (DqCnMerge (TDqOutput $8 '0) '('('1 '"Asc") '('0 '"Asc"))))
(let $10 (DqPhyStage '($9) (lambda '($61) (FromFlow (NarrowMap (ToFlow $61) (lambda '($62 $63) (AsStruct '('"maxd" $62) '('"sumc" $63)))))) '('('"_logical_id" '2054) '('"_id" '"21199ffc-d8783967-8f19749a-9f2cbbf9"))))
(let $11 '($4 $8 $10))
(let $12 (DqCnResult (TDqOutput $10 '0) '('"sumc" '"maxd")))
(return (KqpPhysicalQuery '((KqpPhysicalTx $11 '($12) '() '('('"type" '"generic")))) '((KqpTxResultBinding (ListType $6) '0 '0)) '('('"type" '"query"))))
)
