(
(let $1 (DataType 'Double))
(let $2 (OptionalType (TupleType $1 (DataType 'Uint64))))
(let $3 '('"value" (DataType 'String)))
(let $4 '('('"_logical_id" '2992) '('"_id" '"ff5824d4-ac2f62ac-1b8eb8ed-c06a4914") '('"_wide_channels" (StructType '('_yql_agg_0 $2) $3))))
(let $5 (DqPhyStage '() (lambda '() (block '(
  (let $14 '@@["StructType";[["key";["DataType";"String"]];["subkey";["DataType";"String"]];["value";["DataType";"String"]]]]@@)
  (let $15 (YqlRowSpec '('NativeYtTypeFlags '0) '('StrictSchema '1) '('UniqueKeys '0) '('Type $14)))
  (let $16 (YtMeta '('CanWrite '1) '('DoesExist '1) '('YqlCompatibleScheme '1) '('InferredScheme '0) '('IsDynamic '0) '('Attrs '('('"native_strict_schema" 'false)))))
  (let $17 (YtStat '('Id '"Input") '('RecordsCount '"4") '('DataSize '"166") '('ChunkCount '1) '('ModifyTime '0) '('Revision '0)))
  (let $18 (YtTable '"Input" $15 $16 $17 '() (Void) (Void) '"/Root/plato"))
  (let $19 (YtReadTable! world (DataSource '"yt" '"/Root/plato") '((YtSection '((YtPath $18 '('"key" '"value") (Void) (Void))) '()))))
  (let $20 (OptionalType (DataType 'Int32)))
  (let $21 (lambda '($29) (Just '((Convert $29 'Double) (Uint64 '1)))))
  (let $22 (Nothing $2))
  (let $23 (lambda '($38 $39) $39 $38))
  (return (DqPhyHashCombine (WideToBlocks (FromFlow (DqReadWideWrap $19 '()))) '-1073741824 (lambda '($24 $25) $25) (lambda '($26 $27 $28) (IfPresent (SafeCast $27 $20) $21 $22)) (lambda '($30 $31 $32 $33) (block '(
    (let $34 (SafeCast $31 $20))
    (let $35 (IfPresent $34 $21 $22))
    (return (IfPresent $33 (lambda '($36) (IfPresent $34 (lambda '($37) (Just '((AggrAdd (Nth $36 '0) (Convert $37 'Double)) (Inc (Nth $36 '1))))) (Just $36))) $35))
  ))) $23))
))) $4))
(let $6 (DqCnHashShuffle (TDqOutput $5 '0) '('1) '0 '"HashV2"))
(let $7 (StructType $3))
(let $8 '('('"_logical_id" '3280) '('"_id" '"e8a8f5f-808ad4cf-ba1d53fc-4e0f0b42") '('"_wide_channels" $7)))
(let $9 (DqPhyStage '($6) (lambda '($40) (block '(
  (let $41 (NarrowSqueezeToDict (ToFlow (WideFromBlocks $40)) (lambda '($44 $45) $45) (lambda '($46 $47) (AsStruct '('_yql_agg_0 $46) '('"value" $47))) '('Auto 'Many)))
  (let $42 (Condense1 (OrderedFlatMap $41 (lambda '($48) (OrderedFlatMap (DictPayloads $48) (lambda '($49) $49)))) (lambda '($50) $50) (lambda '($51 $52) (AggrNotEquals (Member $51 '"value") (Member $52 '"value"))) (lambda '($53 $54) (block '(
    (let $55 (Member $53 '_yql_agg_0))
    (let $56 (Member $54 '_yql_agg_0))
    (let $57 (IfPresent $55 (lambda '($58) (IfPresent $56 (lambda '($59) (Just '((AggrAdd (Nth $58 '0) (Nth $59 '0)) (AggrAdd (Nth $58 '1) (Nth $59 '1))))) $55)) $56))
    (return (AsStruct '('_yql_agg_0 $57) '('"value" (Member $54 '"value"))))
  )))))
  (let $43 (Sort (Map (Filter $42 (lambda '($60) (block '(
    (let $61 (IfPresent (Member $60 '_yql_agg_0) (lambda '($62) (Just (Div (Nth $62 '0) (Nth $62 '1)))) (Nothing (OptionalType $1))))
    (return (Coalesce (> $61 (Int32 '"100")) (Bool 'false)))
  )))) (lambda '($63) (AsStruct '('"value" (Member $63 '"value"))))) (Bool 'true) (lambda '($64) (Member $64 '"value"))))
  (return (FromFlow (ExpandMap $43 (lambda '($65) (Member $65 '"value")))))
))) $8))
(let $10 (DqCnMerge (TDqOutput $9 '0) '('('0 '"Asc"))))
(let $11 (DqPhyStage '($10) (lambda '($66) (FromFlow (NarrowMap (ToFlow $66) (lambda '($67) (AsStruct '('"value" $67)))))) '('('"_logical_id" '3292) '('"_id" '"6a129020-bf01b9e0-13207f7a-516cf0f1"))))
(let $12 '($5 $9 $11))
(let $13 (DqCnResult (TDqOutput $11 '0) '('"value")))
(return (KqpPhysicalQuery '((KqpPhysicalTx $12 '($13) '() '('('"type" '"generic")))) '((KqpTxResultBinding (ListType $7) '0 '0)) '('('"type" '"query"))))
)
