(
(declare %kqp%tx_result_binding_0_0 (OptionalType (StructType '('Count0 (DataType 'Uint64)) '('Count1 (DataType 'Uint64)))))
(let $1 '@@["StructType";[["key";["DataType";"String"]];["subkey";["DataType";"String"]];["value";["DataType";"String"]]]]@@)
(let $2 (YqlRowSpec '('NativeYtTypeFlags '0) '('StrictSchema '1) '('UniqueKeys '0) '('Type $1)))
(let $3 (YtMeta '('CanWrite '1) '('DoesExist '1) '('YqlCompatibleScheme '1) '('InferredScheme '0) '('IsDynamic '0) '('Attrs '('('"native_strict_schema" 'false)))))
(let $4 (YtStat '('Id '"Input2") '('RecordsCount '"4") '('DataSize '"164") '('ChunkCount '1) '('ModifyTime '0) '('Revision '0)))
(let $5 (YtTable '"Input2" $2 $3 $4 '() (Void) (Void) '"/Root/plato"))
(let $6 (YtReadTable! world (DataSource '"yt" '"/Root/plato") '((YtSection '((YtPath $5 '('"key") (Void) (Void))) '()))))
(let $7 (DqReadWideWrap $6 '()))
(let $8 (Uint64 '1))
(let $9 (Bool 'false))
(let $10 (DataType 'Uint64))
(let $11 (OptionalType $10))
(let $12 (Nothing $11))
(let $13 '('"_logical_id" '1869))
(let $14 '('"_wide_channels" (StructType '('_yql_agg_0 $11) '('_yql_agg_1 $11))))
(let $15 '($13 '('"_id" '"80415d7b-ed796634-b428ce03-4a787f33") $14))
(let $16 (DqPhyStage '() (lambda '() (block '(
  (let $38 (Condense1 (NarrowMap $7 (lambda '($40) (AsStruct '('"key" $40)))) (lambda '($41) $8) (lambda '($42 $43) $9) (lambda '($44 $45) (Inc $45))))
  (let $39 (lambda '($46) $12 (Just $46)))
  (return (FromFlow (ExpandMap $38 $39)))
))) $15))
(let $17 '($13 '('"_id" '"ac4e0871-9915eb6e-df6b4e48-e3561959") '('"_wide_channels" (StructType '('_yql_agg_0 $10) '('"key" (DataType 'String))))))
(let $18 (DqPhyStage '() (lambda '() (block '(
  (let $47 (lambda '($54 $55) $55 $54))
  (return (DqPhyHashCombine (WideToBlocks (FromFlow $7)) '-1073741824 (lambda '($48) $48) (lambda '($49 $50) $8) (lambda '($51 $52 $53) $53) $47))
))) $17))
(let $19 (DqCnHashShuffle (TDqOutput $18 '0) '('1) '0 '"HashV2"))
(let $20 '('('"_logical_id" '1974) '('"_id" '"ab02ef3d-e2d02aa9-d17e7b78-7b84d0f2") '('"_partition_mode" '"aggregate") $14))
(let $21 (DqPhyStage '($19) (lambda '($56) (block '(
  (let $57 (NarrowSqueezeToDict (ToFlow (WideFromBlocks $56)) (lambda '($60 $61) $61) (lambda '($62 $63) (AsStruct '('_yql_agg_0 $62) '('"key" $63))) '('Auto 'Many)))
  (let $58 (Condense1 (OrderedFlatMap $57 (lambda '($64) (OrderedFlatMap (DictPayloads $64) (lambda '($65) $65)))) (lambda '($66) $66) (lambda '($67 $68) (AggrNotEquals (Member $67 '"key") (Member $68 '"key"))) (lambda '($69 $70) $69)))
  (let $59 (lambda '($71) (Just (Member $71 '_yql_agg_0)) $12))
  (return (FromFlow (ExpandMap $58 $59)))
))) $20))
(let $22 (DqCnParallelUnionAll (TDqOutput $16 '0)))
(let $23 (DqCnParallelUnionAll (TDqOutput $21 '0)))
(let $24 '('('"_logical_id" '2244) '('"_id" '"710e386c-493f67ff-a0f73b31-1e896660") $14))
(let $25 (DqPhyStage '($22 $23) (lambda '($72 $73) (FromFlow (Extend (ToFlow $72) (ToFlow $73)))) $24))
(let $26 (DqCnUnionAll (TDqOutput $25 '0)))
(let $27 (OptionalType (StructType '('Count0 $10) '('Count1 $10))))
(let $28 (DqPhyStage '($26) (lambda '($74) (block '(
  (let $75 (lambda '($78 $79) $78 $79))
  (let $76 (lambda '($84 $85 $86 $87) (block '(
    (let $88 (IfPresent $84 (lambda '($90) (IfPresent $86 (lambda '($91) (Just (AggrAdd $90 $91))) $84)) $86))
    (let $89 (IfPresent $85 (lambda '($92) (IfPresent $87 (lambda '($93) (Just (AggrAdd $92 $93))) $85)) $87))
    (return $88 $89)
  ))))
  (let $77 (WideCondense1 (ToFlow $74) $75 (lambda '($80 $81 $82 $83) $9) $76))
  (return (FromFlow (Condense (NarrowMap (Take $77 $8) (lambda '($94 $95) (AsStruct '('Count0 (Unwrap $94)) '('Count1 (Unwrap $95))))) (Nothing $27) (lambda '($96 $97) $9) (lambda '($98 $99) (Just $98)))))
))) '('('"_logical_id" '2507) '('"_id" '"3604756c-2f6ebc35-2b2bd0c8-15790ade"))))
(let $29 '($16 $18 $21 $25 $28))
(let $30 (DqCnValue (TDqOutput $28 '0)))
(let $31 (KqpPhysicalTx $29 '($30) '() '('('"type" '"compute"))))
(let $32 '"%kqp%tx_result_binding_0_0")
(let $33 '('('"_logical_id" '2567) '('"_id" '"3c78b324-46577025-c1852a14-8c1b4e0") '('"_partition_mode" '"single")))
(let $34 (DqPhyStage '() (lambda '() (block '(
  (let $100 %kqp%tx_result_binding_0_0)
  (let $101 (Uint64 '0))
  (return (Iterator (AsList (AsStruct '('"dist" (Coalesce (Member $100 'Count0) $101)) '('"full" (Coalesce (Member $100 'Count1) $101))))))
))) $33))
(let $35 (DqCnResult (TDqOutput $34 '0) '('"dist" '"full")))
(let $36 (KqpTxResultBinding $27 '0 '0))
(let $37 (KqpPhysicalTx '($34) '($35) '('($32 $36)) '('('"type" '"generic"))))
(return (KqpPhysicalQuery '($31 $37) '((KqpTxResultBinding (ListType (StructType '('"dist" $10) '('"full" $10))) '1 '0)) '('('"type" '"query"))))
)
