(
(let $1 (DataType 'String))
(let $2 (OptionalType $1))
(let $3 (lambda '($54 $55 $56 $57 $58) '($55 $56) '($57 $58) $54))
(let $4 (TupleType $2 $2))
(let $5 '('"key" $1))
(let $6 (StructType '('_yql_agg_0 $4) '('_yql_agg_1 $4) $5))
(let $7 '('('"_logical_id" '1326) '('"_id" '"a9cc48f8-378036b0-bcc833d7-d9f0e3e5") '('"_wide_channels" $6)))
(let $8 (DqPhyStage '() (lambda '() (block '(
  (let $18 '@@["StructType";[["key";["DataType";"String"]];["subkey";["DataType";"String"]];["value";["DataType";"String"]]]]@@)
  (let $19 (YqlRowSpec '('NativeYtTypeFlags '0) '('StrictSchema '1) '('UniqueKeys '0) '('Type $18)))
  (let $20 (YtMeta '('CanWrite '1) '('DoesExist '1) '('YqlCompatibleScheme '1) '('InferredScheme '0) '('IsDynamic '0) '('Attrs '('('"native_strict_schema" '"false")))))
  (let $21 (YtStat '('Id '"Input") '('RecordsCount '"10") '('DataSize '"396") '('ChunkCount '1) '('ModifyTime '0) '('Revision '0)))
  (let $22 (YtTable '"Input" $19 $20 $21 '() (Void) (Void) '"/Root/plato"))
  (let $23 '('"key" '"subkey" '"value"))
  (let $24 (YtReadTable! world (DataSource '"yt" '"/Root/plato") '((YtSection '((YtPath $22 $23 (Void) (Void))) '()))))
  (let $25 (Int32 '0))
  (let $26 (Nothing $2))
  (let $27 (lambda '($32 $33 $34 $35) (block '(
    (let $36 (If (!= (Size $34) $25) (Just $34) $26))
    (let $37 (If (!= (Size $35) $25) (Just $35) $26))
    (return $36 $37 $36 $37)
  ))))
  (let $28 (lambda '($38 $39 $40 $41 $42 $43 $44 $45) (block '(
    (let $46 (If (!= (Size $40) $25) (Just $40) $26))
    (let $47 (If (!= (Size $41) $25) (Just $41) $26))
    (let $48 (If (AggrEquals $46 $42) (AggrGreaterOrEqual $47 $43) (AggrGreater $46 $42)))
    (let $49 (If $48 $46 $42))
    (let $50 (If $48 $47 $43))
    (let $51 (If (AggrEquals $46 $44) (AggrLessOrEqual $47 $45) (AggrLess $46 $44)))
    (let $52 (If $51 $46 $44))
    (let $53 (If $51 $47 $45))
    (return $49 $50 $52 $53)
  ))))
  (return (DqPhyHashCombine (WideToBlocks (FromFlow (DqReadWideWrap $24 '()))) '-1073741824 (lambda '($29 $30 $31) $29) $27 $28 $3))
))) $7))
(let $9 (DqCnHashShuffle (TDqOutput $8 '0) '('2) '0 '"HashV2"))
(let $10 (StructType $5 '('max $4) '('min $4)))
(let $11 '('('"_logical_id" '2411) '('"_id" '"6c5b3820-3246c46a-813b22c3-82052bd5") '('"_wide_channels" $10)))
(let $12 (DqPhyStage '($9) (lambda '($59) (block '(
  (let $60 (lambda '($67 $68 $69 $70) (Nth $68 '0) (Nth $68 '1) (Nth $69 '0) (Nth $69 '1)))
  (let $61 (lambda '($71 $72 $73 $74 $75 $76 $77 $78) (block '(
    (let $79 (Nth $72 '0))
    (let $80 (If (AggrEquals $79 $75) (AggrGreaterOrEqual (Nth $72 '1) $76) (AggrGreater $79 $75)))
    (let $81 (If $80 $72 '($75 $76)))
    (let $82 (Nth $73 '0))
    (let $83 (If (AggrEquals $82 $77) (AggrLessOrEqual (Nth $73 '1) $78) (AggrLess $82 $77)))
    (let $84 (If $83 $73 '($77 $78)))
    (return (Nth $81 '0) (Nth $81 '1) (Nth $84 '0) (Nth $84 '1))
  ))))
  (let $62 (WideCombiner (ToFlow (WideFromBlocks $59)) '"" (lambda '($64 $65 $66) $66) $60 $61 $3))
  (let $63 (lambda '($85 $86 $87) $87 $85 $86))
  (return (FromFlow (WideMap (WideSort $62 '('('2 (Bool 'true)))) $63)))
))) $11))
(let $13 (DqCnMerge (TDqOutput $12 '0) '('('0 '"Asc"))))
(let $14 (DqPhyStage '($13) (lambda '($88) (FromFlow (NarrowMap (ToFlow $88) (lambda '($89 $90 $91) (AsStruct '('"key" $89) '('max $90) '('min $91)))))) '('('"_logical_id" '2423) '('"_id" '"22bc505-4e70278-3d908a2d-14d5a7dc"))))
(let $15 '($8 $12 $14))
(let $16 '('"key" 'min 'max))
(let $17 (DqCnResult (TDqOutput $14 '0) $16))
(return (KqpPhysicalQuery '((KqpPhysicalTx $15 '($17) '() '('('"type" '"generic")))) '((KqpTxResultBinding (ListType $10) '0 '0)) '('('"type" '"query"))))
)
