(
(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 '"Input") '('RecordsCount '"4") '('DataSize '"166") '('ChunkCount '1) '('ModifyTime '0) '('Revision '0)))
(let $5 (YtTable '"Input" $2 $3 $4 '() (Void) (Void) '"/Root/plato"))
(let $6 (YtReadTable! world (DataSource '"yt" '"/Root/plato") '((YtSection '((YtPath $5 '('"key") (Void) (Void))) '()))))
(let $7 (lambda '($102) (AsStruct '('"key" $102))))
(let $8 (ResourceType '"Stat.TDigestResource"))
(let $9 '($8))
(let $10 (DataType 'Double))
(let $11 '($10))
(let $12 '((OptionalType $10)))
(let $13 (CallableType '('2) $9 $11 $12 $12))
(let $14 (Udf '"Stat.TDigest_Create" (Void) (VoidType) '"" $13 (VoidType) '"" '()))
(let $15 (DataType 'Interval))
(let $16 (OptionalType $15))
(let $17 (SafeCast (Int32 '0) $15))
(let $18 (DependsOn (Uint32 '0)))
(let $19 (Bool 'false))
(let $20 (CallableType '() $9 $9 $11))
(let $21 '('('"strict")))
(let $22 (Udf '"Stat.TDigest_AddValue" (Void) (VoidType) '"" $20 (VoidType) '"" $21))
(let $23 (DataType 'String))
(let $24 '($23))
(let $25 (CallableType '() $24 $9))
(let $26 (Udf '"Stat.TDigest_Serialize" (Void) (VoidType) '"" $25 (VoidType) '"" $21))
(let $27 '('('"_logical_id" '16904) '('"_id" '"66404cbd-d4707156-ca53e2c1-8cec2004") '('"_wide_channels" (StructType '('_yql_agg_0 $23)))))
(let $28 (DqPhyStage '() (lambda '() (block '(
  (let $101 (Condense1 (NarrowMap (DqReadWideWrap $6 '()) $7) (lambda '($103) (NamedApply $14 '((SafeCast (Coalesce (SafeCast (Member $103 '"key") $16) $17) $10)) (AsStruct) $18)) (lambda '($104 $105) $19) (lambda '($106 $107) (NamedApply $22 '($107 (SafeCast (Coalesce (SafeCast (Member $106 '"key") $16) $17) $10)) (AsStruct) $18))))
  (return (FromFlow (ExpandMap $101 (lambda '($108) (Apply $26 $108)))))
))) $27))
(let $29 (DqCnUnionAll (TDqOutput $28 '0)))
(let $30 (CallableType '() $9 $24))
(let $31 (Udf '"Stat.TDigest_Deserialize" (Void) (VoidType) '"" $30 (VoidType) '"" '()))
(let $32 (CallableType '() $9 $9 $9))
(let $33 (Udf '"Stat.TDigest_Merge" (Void) (VoidType) '"" $32 (VoidType) '"" $21))
(let $34 (CallableType '() $11 $9 $11))
(let $35 (Udf '"Stat.TDigest_GetPercentile" (Void) (VoidType) '"" $34 (VoidType) '"" $21))
(let $36 (Double '"0.8"))
(let $37 (DataType 'Int64))
(let $38 '('"_partition_mode" '"aggregate"))
(let $39 (StructType '('Percentile0 $15)))
(let $40 '('('"_logical_id" '17410) '('"_id" '"1e28cd27-47dd7845-3a9929a1-c8ad588") $38 '('"_wide_channels" $39)))
(let $41 (DqPhyStage '($29) (lambda '($109) (block '(
  (let $110 (WideCondense1 (ToFlow $109) (lambda '($111) (Apply $31 $111)) (lambda '($112 $113) $19) (lambda '($114 $115) (Apply $33 (Apply $31 $114) $115))))
  (return (FromFlow (WideMap $110 (lambda '($116) (block '(
    (let $117 (Apply $35 $116 $36))
    (return (Unwrap (SafeCast (ToIntegral $117 $37) $16)))
  ))))))
))) $40))
(let $42 (DqCnUnionAll (TDqOutput $41 '0)))
(let $43 (DqPhyStage '($42) (lambda '($118) (block '(
  (let $119 (Condense (NarrowMap (ToFlow $118) (lambda '($120) (AsStruct '('Percentile0 $120)))) (List (ListType $39)) (lambda '($121 $122) $19) (lambda '($123 $124) (AsList $123))))
  (return (FromFlow (Map $119 (lambda '($125) (AsStruct '('"column0" (Member (ToOptional $125) 'Percentile0)))))))
))) '('('"_logical_id" '17464) '('"_id" '"9a77e18a-f612693-82ee12a6-dc880f5a"))))
(let $44 '($28 $41 $43))
(let $45 '('"column0"))
(let $46 (DqCnResult (TDqOutput $43 '0) $45))
(let $47 '('('"type" '"generic")))
(let $48 (KqpPhysicalTx $44 '($46) '() $47))
(let $49 (NarrowMap (DqReadWideWrap $6 '()) $7))
(let $50 (SafeCast (Int32 '1) $15))
(let $51 (OptionalType $8))
(let $52 (Nothing $51))
(let $53 (lambda '($130 $131) $19))
(let $54 (OptionalType $23))
(let $55 '('"_wide_channels" (StructType '('_yql_agg_0 $54))))
(let $56 '('('"_logical_id" '18122) '('"_id" '"3a1ac8d8-e161bf70-1130dde8-c236cf4e") $55))
(let $57 (DqPhyStage '() (lambda '() (block '(
  (let $126 (lambda '($129) (Just (NamedApply $14 '((SafeCast $129 $10)) (AsStruct) $18))))
  (let $127 (Condense1 $49 (lambda '($128) (IfPresent (+ (Coalesce (SafeCast (Member $128 '"key") $16) $17) $50) $126 $52)) $53 (lambda '($132 $133) (block '(
    (let $134 (+ (Coalesce (SafeCast (Member $132 '"key") $16) $17) $50))
    (let $135 (IfPresent $134 $126 $52))
    (return (IfPresent $133 (lambda '($136) (IfPresent $134 (lambda '($137) (Just (NamedApply $22 '($136 (SafeCast $137 $10)) (AsStruct) $18))) (Just $136))) $135))
  )))))
  (return (FromFlow (ExpandMap $127 (lambda '($138) (IfPresent $138 (lambda '($139) (Just (Apply $26 $139))) (Nothing $54))))))
))) $56))
(let $58 (DqCnUnionAll (TDqOutput $57 '0)))
(let $59 (StructType '('Percentile0 $16)))
(let $60 '('"_wide_channels" $59))
(let $61 '('('"_logical_id" '18786) '('"_id" '"9bab19a9-23ce2a8a-b10fe8d9-d2037047") $38 $60))
(let $62 (DqPhyStage '($58) (lambda '($140) (block '(
  (let $141 (lambda '($144) (Just (Apply $31 $144))))
  (let $142 (WideCondense1 (ToFlow $140) (lambda '($143) (IfPresent $143 $141 $52)) (lambda '($145 $146) $19) (lambda '($147 $148) (IfPresent $147 (lambda '($149) (block '(
    (let $150 (IfPresent $147 $141 $52))
    (return (IfPresent $148 (lambda '($151) (Just (Apply $33 (Apply $31 $149) $151))) $150))
  ))) $148))))
  (return (FromFlow (WideMap $142 (lambda '($152) (IfPresent $152 (lambda '($153) (block '(
    (let $154 (Apply $35 $153 $36))
    (return (Just (Unwrap (SafeCast (ToIntegral $154 $37) $16))))
  ))) (Nothing $16))))))
))) $61))
(let $63 (DqCnUnionAll (TDqOutput $62 '0)))
(let $64 (lambda '($157) (AsStruct '('Percentile0 $157))))
(let $65 (List (ListType $59)))
(let $66 (lambda '($158 $159) $19))
(let $67 (lambda '($160 $161) (AsList $160)))
(let $68 (DqPhyStage '($63) (lambda '($155) (block '(
  (let $156 (Condense (NarrowMap (ToFlow $155) $64) $65 $66 $67))
  (return (FromFlow (Map $156 (lambda '($162) (AsStruct '('"column0" (Member (ToOptional $162) 'Percentile0)))))))
))) '('('"_logical_id" '18836) '('"_id" '"a38aae16-e470c871-de7ffe1f-6dbd54c3"))))
(let $69 '($57 $62 $68))
(let $70 (DqCnResult (TDqOutput $68 '0) $45))
(let $71 (KqpPhysicalTx $69 '($70) '() $47))
(let $72 (Nothing $51))
(let $73 '('('"_logical_id" '19493) '('"_id" '"665055c1-af27e48e-7d2e3290-97ca48f9") $55))
(let $74 (DqPhyStage '() (lambda '() (block '(
  (let $163 (lambda '($166) (Just (NamedApply $14 '((SafeCast $166 $10)) (AsStruct) $18))))
  (let $164 (Condense1 $49 (lambda '($165) (IfPresent (+ (Coalesce (SafeCast (Member $165 '"key") $16) $17) $50) $163 $72)) $53 (lambda '($167 $168) (block '(
    (let $169 (+ (Coalesce (SafeCast (Member $167 '"key") $16) $17) $50))
    (let $170 (IfPresent $169 $163 $72))
    (return (IfPresent $168 (lambda '($171) (IfPresent $169 (lambda '($172) (Just (NamedApply $22 '($171 (SafeCast $172 $10)) (AsStruct) $18))) (Just $171))) $170))
  )))))
  (return (FromFlow (ExpandMap $164 (lambda '($173) (IfPresent $173 (lambda '($174) (Just (Apply $26 $174))) (Nothing $54))))))
))) $73))
(let $75 (DqCnUnionAll (TDqOutput $74 '0)))
(let $76 (StructType '('Percentile1 $16)))
(let $77 '('('"_logical_id" '20157) '('"_id" '"ff3004e7-cb15efe7-b8b019a8-8bccdd39") $38 '('"_wide_channels" $76)))
(let $78 (DqPhyStage '($75) (lambda '($175) (block '(
  (let $176 (lambda '($179) (Just (Apply $31 $179))))
  (let $177 (WideCondense1 (ToFlow $175) (lambda '($178) (IfPresent $178 $176 $72)) (lambda '($180 $181) $19) (lambda '($182 $183) (IfPresent $182 (lambda '($184) (block '(
    (let $185 (IfPresent $182 $176 $72))
    (return (IfPresent $183 (lambda '($186) (Just (Apply $33 (Apply $31 $184) $186))) $185))
  ))) $183))))
  (return (FromFlow (WideMap $177 (lambda '($187) (IfPresent $187 (lambda '($188) (block '(
    (let $189 (Apply $35 $188 (Double '"0.6")))
    (return (Just (Unwrap (SafeCast (ToIntegral $189 $37) $16))))
  ))) (Nothing $16))))))
))) $77))
(let $79 (DqCnUnionAll (TDqOutput $78 '0)))
(let $80 (DqPhyStage '($79) (lambda '($190) (block '(
  (let $191 (Condense (NarrowMap (ToFlow $190) (lambda '($192) (AsStruct '('Percentile1 $192)))) (List (ListType $76)) (lambda '($193 $194) $19) (lambda '($195 $196) (AsList $195))))
  (return (FromFlow (Map $191 (lambda '($197) (AsStruct '('"column0" (Member (ToOptional $197) 'Percentile1)))))))
))) '('('"_logical_id" '20211) '('"_id" '"34607181-c90822b9-385fcb54-e9d39338"))))
(let $81 '($74 $78 $80))
(let $82 (DqCnResult (TDqOutput $80 '0) $45))
(let $83 (KqpPhysicalTx $81 '($82) '() $47))
(let $84 '('('"_logical_id" '20517) '('"_id" '"1ad2a05d-dde0bc-581b5682-a33093a5") $55))
(let $85 (DqPhyStage '() (lambda '() (block '(
  (let $198 (Condense1 (NarrowMap (DqReadWideWrap $6 '()) $7) (lambda '($199) (Just (NamedApply $14 '((SafeCast (Coalesce (SafeCast (Member $199 '"key") $16) $17) $10)) (AsStruct) $18))) $53 (lambda '($200 $201) (block '(
    (let $202 (SafeCast (Coalesce (SafeCast (Member $200 '"key") $16) $17) $10))
    (return (IfPresent $201 (lambda '($203) (Just (NamedApply $22 '($203 $202) (AsStruct) $18))) (Just (NamedApply $14 '($202) (AsStruct) $18))))
  )))))
  (return (FromFlow (ExpandMap $198 (lambda '($204) (IfPresent $204 (lambda '($205) (Just (Apply $26 $205))) (Nothing $54))))))
))) $84))
(let $86 (DqCnUnionAll (TDqOutput $85 '0)))
(let $87 '('('"_logical_id" '21181) '('"_id" '"5f4d501e-627ef8d8-2d431215-133542e9") $38 $60))
(let $88 (DqPhyStage '($86) (lambda '($206) (block '(
  (let $207 (lambda '($211) (Just (Apply $31 $211))))
  (let $208 (Nothing $51))
  (let $209 (WideCondense1 (ToFlow $206) (lambda '($210) (IfPresent $210 $207 $208)) (lambda '($212 $213) $19) (lambda '($214 $215) (IfPresent $214 (lambda '($216) (block '(
    (let $217 (IfPresent $214 $207 $208))
    (return (IfPresent $215 (lambda '($218) (Just (Apply $33 (Apply $31 $216) $218))) $217))
  ))) $215))))
  (return (FromFlow (WideMap $209 (lambda '($219) (IfPresent $219 (lambda '($220) (block '(
    (let $221 (Apply $35 $220 (Double '"0.4")))
    (return (Just (Unwrap (SafeCast (ToIntegral $221 $37) $16))))
  ))) (Nothing $16))))))
))) $87))
(let $89 (DqCnUnionAll (TDqOutput $88 '0)))
(let $90 (DqPhyStage '($89) (lambda '($222) (block '(
  (let $223 (Condense (NarrowMap (ToFlow $222) $64) $65 $66 $67))
  (return (FromFlow (Map $223 (lambda '($224) (AsStruct '('result (Member (ToOptional $224) 'Percentile0)))))))
))) '('('"_logical_id" '21231) '('"_id" '"2ba800ee-ae5dd384-39393632-1bcd39af"))))
(let $91 '($85 $88 $90))
(let $92 (DqCnResult (TDqOutput $90 '0) '('result)))
(let $93 (KqpPhysicalTx $91 '($92) '() $47))
(let $94 '($48 $71 $83 $93))
(let $95 (ListType (StructType '('"column0" $16))))
(let $96 (KqpTxResultBinding $95 '0 '0))
(let $97 (KqpTxResultBinding $95 '1 '0))
(let $98 (KqpTxResultBinding $95 '2 '0))
(let $99 (KqpTxResultBinding (ListType (StructType '('result $16))) '"3" '0))
(let $100 '($96 $97 $98 $99))
(return (KqpPhysicalQuery $94 $100 '('('"type" '"query"))))
)
