(
(let $1 (DataSource '"yt" '"/Root/plato"))
(let $2 '@@["StructType";[["key";["DataType";"String"]];["subkey";["DataType";"String"]];["value";["DataType";"String"]]]]@@)
(let $3 (Bool 'false))
(let $4 (DataType 'String))
(let $5 (YqlRowSpec '('NativeYtTypeFlags '0) '('StrictSchema '1) '('UniqueKeys '0) '('Type $2) '('SortDirections '($3)) '('SortMembers '('"key")) '('SortedBy '('"_yql_column_0")) '('SortedByTypes '($4))))
(let $6 (YtMeta '('CanWrite '1) '('DoesExist '1) '('YqlCompatibleScheme '1) '('InferredScheme '0) '('IsDynamic '0) '('Attrs '('('"native_strict_schema" 'false)))))
(let $7 (YtStat '('Id '"Input") '('RecordsCount '"10") '('DataSize '"1290") '('ChunkCount '1) '('ModifyTime '0) '('Revision '0)))
(let $8 (YtTable '"Input" $5 $6 $7 '() (Void) (Void) '"/Root/plato"))
(let $9 '('('"unordered")))
(let $10 (String '"xxx"))
(let $11 (Uint64 '3))
(let $12 '('('0 $3)))
(let $13 '('"subkey" $4))
(let $14 '('('"_logical_id" '1759) '('"_id" '"415b19ac-eec54346-b5db1eb3-e9f887db") '('"_wide_channels" (StructType '('"key" $4) $13))))
(let $15 (DqPhyStage '() (lambda '() (block '(
  (let $47 '('"key" '"subkey" '"value"))
  (let $48 (YtReadTable! world $1 '((YtSection '((YtPath $8 $47 (Void) (Void))) $9))))
  (let $49 (WideTop (WideFilter (DqReadWideWrap $48 '()) (lambda '($51 $52 $53) (!= $53 $10))) $11 $12))
  (let $50 (lambda '($54 $55 $56) $54 $55))
  (return (FromFlow (WideMap $49 $50)))
))) $14))
(let $16 (DqCnUnionAll (TDqOutput $15 '0)))
(let $17 (lambda '($62) $62))
(let $18 (StructType $13))
(let $19 '('"_wide_channels" $18))
(let $20 '('('"_logical_id" '1855) '('"_id" '"b4e58f83-5a6aceea-8afcf08c-2d1f8fd0") $19))
(let $21 (DqPhyStage '($16) (lambda '($57) (block '(
  (let $58 (WideTop (ToFlow $57) $11 $12))
  (let $59 (lambda '($60 $61) $61))
  (return (DqPhyHashCombine (WideToBlocks (FromFlow (WideMap $58 $59))) '-1073741824 $17 (lambda '($63 $64) $63) (lambda '($65 $66 $67) $67) $59))
))) $20))
(let $22 (DqCnHashShuffle (TDqOutput $21 '0) '('0) '0 '"HashV2"))
(let $23 '('('"_logical_id" '2153) '('"_id" '"3e50c6c-1b171fcc-66d52597-f04fb5e9") $19))
(let $24 (DqPhyStage '($22) (lambda '($68) (block '(
  (let $69 (lambda '($71 $72)))
  (let $70 (WideCombiner (ToFlow (WideFromBlocks $68)) '"" $17 $69 $69 $17))
  (return (FromFlow (WideSort $70 '('('0 (Bool 'true))))))
))) $23))
(let $25 (DqCnMerge (TDqOutput $24 '0) '('('0 '"Asc"))))
(let $26 (DqPhyStage '($25) (lambda '($73) (FromFlow (NarrowMap (ToFlow $73) (lambda '($74) (AsStruct '('"subkey" $74)))))) '('('"_logical_id" '2165) '('"_id" '"4f05b6-77b04932-bb97b5e9-9a54cf94"))))
(let $27 '($15 $21 $24 $26))
(let $28 (DqCnResult (TDqOutput $26 '0) '('"subkey")))
(let $29 '('('"type" '"generic")))
(let $30 (KqpPhysicalTx $27 '($28) '() $29))
(let $31 (DataType 'Int64))
(let $32 (OptionalType $31))
(let $33 (lambda '($91) $91))
(let $34 '('('"_logical_id" '2654) '('"_id" '"7c3a60d4-65e9885c-7a98f3f6-aa7af991") '('"_wide_channels" (StructType '('_yql_agg_0 $32)))))
(let $35 (DqPhyStage '() (lambda '() (block '(
  (let $75 (YtReadTable! world $1 '((YtSection '((YtPath $8 '('"subkey" '"value") (Void) (Void))) $9))))
  (let $76 (OptionalType (DataType 'Int32)))
  (let $77 (lambda '($85) (Just (SafeCast $85 $31))))
  (let $78 (Nothing $32))
  (let $79 (Condense1 (NarrowMap (WideFilter (DqReadWideWrap $75 '()) (lambda '($80 $81) (!= $81 $10))) (lambda '($82 $83) (AsStruct '('"subkey" $82)))) (lambda '($84) (IfPresent (SafeCast (Member $84 '"subkey") $76) $77 $78)) (lambda '($86 $87) $3) (lambda '($88 $89) (block '(
    (let $90 (IfPresent (SafeCast (Member $88 '"subkey") $76) $77 $78))
    (return (AggrAdd $90 $89))
  )))))
  (return (FromFlow (ExpandMap $79 $33)))
))) $34))
(let $36 (DqCnUnionAll (TDqOutput $35 '0)))
(let $37 (StructType '('Sum0 $32)))
(let $38 '('('"_logical_id" '3656) '('"_id" '"feb7ec4b-b5de46bd-188508a2-4c185030") '('"_partition_mode" '"aggregate") '('"_wide_channels" $37)))
(let $39 (DqPhyStage '($36) (lambda '($92) (FromFlow (WideCondense1 (ToFlow $92) $33 (lambda '($93 $94) $3) (lambda '($95 $96) (AggrAdd $95 $96))))) $38))
(let $40 (DqCnUnionAll (TDqOutput $39 '0)))
(let $41 (DqPhyStage '($40) (lambda '($97) (block '(
  (let $98 (Condense (NarrowMap (ToFlow $97) (lambda '($99) (AsStruct '('Sum0 $99)))) (List (ListType $37)) (lambda '($100 $101) $3) (lambda '($102 $103) (AsList $102))))
  (return (FromFlow (Map $98 (lambda '($104) (AsStruct '('"c" (Member (ToOptional $104) 'Sum0)))))))
))) '('('"_logical_id" '3706) '('"_id" '"991f2c94-f74536f9-7df24c2c-54102975"))))
(let $42 '($35 $39 $41))
(let $43 (DqCnResult (TDqOutput $41 '0) '('"c")))
(let $44 (KqpPhysicalTx $42 '($43) '() $29))
(let $45 (KqpTxResultBinding (ListType $18) '0 '0))
(let $46 (KqpTxResultBinding (ListType (StructType '('"c" $32))) '1 '0))
(return (KqpPhysicalQuery '($30 $44) '($45 $46) '('('"type" '"query"))))
)
