(
(declare %kqp%tx_result_binding_0_0 (ListType (StructType '('"count" (DataType 'Uint64)) '('"key" (DataType 'String)))))
(let $1 '@@["StructType";[["key";["DataType";"String"]];["subkey";["DataType";"String"]];["value";["DataType";"String"]]]]@@)
(let $2 (Bool 'true))
(let $3 '($2 $2))
(let $4 '('"key" '"subkey"))
(let $5 (DataType 'String))
(let $6 (YqlRowSpec '('NativeYtTypeFlags '0) '('StrictSchema '1) '('UniqueKeys '0) '('Type $1) '('SortDirections $3) '('SortMembers $4) '('SortedBy $4) '('SortedByTypes '($5 $5))))
(let $7 (YtMeta '('CanWrite '1) '('DoesExist '1) '('YqlCompatibleScheme '1) '('InferredScheme '0) '('IsDynamic '0) '('HasRLS '0) '('Attrs '('('"native_strict_schema" 'false)))))
(let $8 (YtStat '('Id '"Input") '('RecordsCount '"4") '('DataSize '"168") '('ChunkCount '1) '('ModifyTime '0) '('Revision '0)))
(let $9 (YtTable '"Input" $6 $7 $8 '() (Void) (Void) '"/Root/plato"))
(let $10 (YtReadTable! world (DataSource '"yt" '"/Root/plato") '((YtSection '((YtPath $9 '('"key") (Void) (Void) (Void))) '('('"unordered"))))))
(let $11 (DqReadWideWrap $10 '()))
(let $12 (String '1))
(let $13 (Uint64 '1))
(let $14 (Bool 'false))
(let $15 (lambda '($57) $57))
(let $16 '('"_logical_id" '3131))
(let $17 (DataType 'Uint64))
(let $18 '('_yql_agg_0 $17))
(let $19 '($16 '('"_id" '"3539fef9-4f152280-ad5dcc7f-3fb55c6e") '('"_wide_channels" (StructType $18))))
(let $20 (DqPhyStage '() (lambda '() (block '(
  (let $49 (Condense1 (NarrowMap (WideFilter $11 (lambda '($50) (!= $50 $12))) (lambda '($51) (AsStruct))) (lambda '($52) $13) (lambda '($53 $54) $14) (lambda '($55 $56) (AggrAdd $56 $13))))
  (return (FromFlow (ExpandMap $49 $15)))
))) $19))
(let $21 (DqCnUnionAll (TDqOutput $20 '0)))
(let $22 (DqPhyStage '($21) (lambda '($58) (block '(
  (let $59 (WideCondense1 (ToFlow $58) $15 (lambda '($61 $62) $14) (lambda '($63 $64) (AggrAdd $63 $64))))
  (let $60 (Condense (NarrowMap (Take $59 $13) (lambda '($65) (AsStruct '('Count0 $65)))) (Nothing (OptionalType (StructType '('Count0 $17)))) (lambda '($66 $67) $14) (lambda '($68 $69) (Just $68))))
  (return (FromFlow (Map $60 (lambda '($70) (AsList (AsStruct '('"count" (Coalesce (Member $70 'Count0) (Uint64 '0))) '('"key" (String '"total"))))))))
))) '('('"_logical_id" '2964) '('"_id" '"3ba7ba28-8a0bef14-b8411e3d-7d8ae0a0"))))
(let $23 (DqCnValue (TDqOutput $22 '0)))
(let $24 (KqpPhysicalTx '($20 $22) '($23) '() '('('"type" '"compute"))))
(let $25 '"%kqp%tx_result_binding_0_0")
(let $26 '('"key" $5))
(let $27 (StructType '('"count" $17) $26))
(let $28 (ListType $27))
(let $29 '('"_wide_channels" $27))
(let $30 '('('"_logical_id" '3253) '('"_id" '"fa054a6e-8cc20da5-ab6534a-9584c635") $29))
(let $31 (DqPhyStage '() (lambda '() (block '(
  (let $71 (lambda '($72) (Member $72 '"count") (Member $72 '"key")))
  (return (FromFlow (ExpandMap (ToFlow %kqp%tx_result_binding_0_0) $71)))
))) $30))
(let $32 (lambda '($80 $81) $81 $80))
(let $33 '($16 '('"_id" '"cb00c5c9-d6cf15d9-4ade64e4-be3e4188") '('"_wide_channels" (StructType $18 $26))))
(let $34 (DqPhyStage '() (lambda '() (FromFlow (DqPhyHashCombine (WideFilter $11 (lambda '($73) (!= $73 $12))) '-1073741824 (lambda '($74) $74) (lambda '($75 $76) $13) (lambda '($77 $78 $79) (AggrAdd $79 $13)) $32))) $33))
(let $35 (DqCnHashShuffle (TDqOutput $34 '0) '('1) '0 '"HashV2"))
(let $36 '('('"_logical_id" '3225) '('"_id" '"32a8280d-422499d3-25acf6ca-49fc8aaa") '('"_partition_mode" '"aggregate") $29))
(let $37 (DqPhyStage '($35) (lambda '($82) (FromFlow (DqPhyHashCombine (ToFlow $82) '"" (lambda '($83 $84) $84) (lambda '($85 $86 $87) $86) (lambda '($88 $89 $90 $91) (AggrAdd $89 $91)) $32))) $36))
(let $38 (DqCnParallelUnionAll (TDqOutput $31 '0)))
(let $39 (DqCnParallelUnionAll (TDqOutput $37 '0)))
(let $40 (lambda '($96 $97) (AsStruct '('"count" $96) '('"key" $97))))
(let $41 '('('"_logical_id" '3334) '('"_id" '"81827186-aecc3a0-e57d9ff8-2f309d9c") $29))
(let $42 (DqPhyStage '($38 $39) (lambda '($92 $93) (block '(
  (let $94 (Sort (Extend (NarrowMap (ToFlow $92) $40) (NarrowMap (ToFlow $93) $40)) $3 (lambda '($98) '((Member $98 '"key") (Member $98 '"count")))))
  (let $95 (lambda '($99) (Member $99 '"count") (Member $99 '"key")))
  (return (FromFlow (ExpandMap $94 $95)))
))) $41))
(let $43 (DqCnMerge (TDqOutput $42 '0) '('('1 '"Asc") '('0 '"Asc"))))
(let $44 (DqPhyStage '($43) (lambda '($100) (FromFlow (NarrowMap (ToFlow $100) $40))) '('('"_logical_id" '3346) '('"_id" '"650365b5-9644d679-652fe1a0-6b36eb31"))))
(let $45 '($31 $34 $37 $42 $44))
(let $46 (DqCnResult (TDqOutput $44 '0) '()))
(let $47 (KqpTxResultBinding $28 '0 '0))
(let $48 (KqpPhysicalTx $45 '($46) '('($25 $47)) '('('"type" '"generic"))))
(return (KqpPhysicalQuery '($24 $48) '((KqpTxResultBinding $28 '1 '0)) '('('"type" '"query"))))
)
