(
(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) '('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))) '('('"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" '3122))
(let $17 (DataType 'Uint64))
(let $18 '('_yql_agg_0 $17))
(let $19 '($16 '('"_id" '"5316b580-aa2fcb82-8f75fd45-76f067d2") '('"_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" '2955) '('"_id" '"38c94c9f-f8551e14-7826b84d-7a1416c0"))))
(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" '3244) '('"_id" '"2197d9b3-947dc5a6-7e12cdd1-d6c02678") $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" '"95e50630-5754925b-a9b02522-142315ff") '('"_wide_channels" (StructType $18 $26))))
(let $34 (DqPhyStage '() (lambda '() (DqPhyHashCombine (WideToBlocks (FromFlow (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" '3216) '('"_id" '"1f802940-45adc731-dcaceb35-5fc84236") '('"_partition_mode" '"aggregate") $29))
(let $37 (DqPhyStage '($35) (lambda '($82) (FromFlow (WideCombiner (ToFlow (WideFromBlocks $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" '3325) '('"_id" '"2519669a-d59f879c-926a4c45-39417160") $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" '3337) '('"_id" '"9572c503-7dd77cdf-4dbb0463-fa5cf63e"))))
(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"))))
)
