(
(let $1 (DataSource '"yt" '"/Root/plato"))
(let $2 '('StrictSchema '1))
(let $3 '('UniqueKeys '0))
(let $4 (Bool 'true))
(let $5 '('"p_partkey"))
(let $6 (DataType 'Int32))
(let $7 (YtMeta '('CanWrite '1) '('DoesExist '1) '('YqlCompatibleScheme '1) '('InferredScheme '0) '('IsDynamic '0)))
(let $8 '('RecordsCount '1))
(let $9 '('ChunkCount '1))
(let $10 '('ModifyTime '0))
(let $11 '('Revision '0))
(let $12 '('('"_logical_id" '5994) '('"_id" '"ab475c07-79c46e3e-cb951ee7-db682198") '('"_wide_channels" (StructType '('"p_partkey" $6)))))
(let $13 (DqPhyStage '() (lambda '() (block '(
  (let $44 '@@["StructType";[["p_partkey";["DataType";"Int32"]];["p_name";["DataType";"String"]];["p_container";["DataType";"String"]];["p_size";["DataType";"Int64"]];["p_type";["DataType";"String"]];["p_comment";["DataType";"String"]];["p_retailprice";["DataType";"Double"]];["p_mfgr";["DataType";"String"]];["p_brand";["DataType";"String"]]]]@@)
  (let $45 (YqlRowSpec '('NativeYtTypeFlags '0) $2 $3 '('Type $44) '('SortDirections '($4)) '('SortMembers $5) '('SortedBy $5) '('SortedByTypes '($6))))
  (let $46 (YtStat '('Id '"part") $8 '('DataSize '"239") $9 $10 $11))
  (let $47 (YtTable '"part" $45 $7 $46 '() (Void) (Void) '"/Root/plato"))
  (let $48 '('"p_brand" '"p_container" '"p_partkey"))
  (let $49 (YtReadTable! world $1 '((YtSection '((YtPath $47 $48 (Void) (Void))) '('('"unordered"))))))
  (return (FromFlow (WideMap (WideFilter (DqReadWideWrap $49 '()) (lambda '($50 $51 $52) (And (== $50 (String '"Brand#35")) (== $51 (String '"LG DRUM"))))) (lambda '($53 $54 $55) $55))))
))) $12))
(let $14 (DqCnBroadcast (TDqOutput $13 '0)))
(let $15 '('Many 'Hashed 'Compact))
(let $16 '@@["StructType";[["l_orderkey";["DataType";"Int32"]];["l_linenumber";["DataType";"Int32"]];["l_discount";["DataType";"Double"]];["l_extendedprice";["DataType";"Double"]];["l_comment";["DataType";"String"]];["l_shipdate";["OptionalType";["DataType";"Date"]]];["l_returnflag";["DataType";"String"]];["l_partkey";["DataType";"Int32"]];["l_tax";["DataType";"Double"]];["l_shipinstruct";["DataType";"String"]];["l_commitdate";["OptionalType";["DataType";"Date"]]];["l_receiptdate";["OptionalType";["DataType";"Date"]]];["l_quantity";["DataType";"Double"]];["l_suppkey";["DataType";"Int32"]];["l_shipmode";["DataType";"String"]];["l_linestatus";["DataType";"String"]]]]@@)
(let $17 '('"l_orderkey" '"l_linenumber"))
(let $18 (YqlRowSpec '('NativeYtTypeFlags '2) $2 $3 '('Type $16) '('SortDirections '($4 $4)) '('SortMembers $17) '('SortedBy $17) '('SortedByTypes '($6 $6))))
(let $19 (YtStat '('Id '"lineitem") $8 '('DataSize '"343") $9 $10 $11))
(let $20 (YtTable '"lineitem" $18 $7 $19 '() (Void) (Void) '"/Root/plato"))
(let $21 '('1))
(let $22 '('"p.p_partkey"))
(let $23 (DataType 'Double))
(let $24 (StructType '('"l.l_extendedprice" $23) '('"l.l_partkey" $6) '('"l.l_quantity" $23) '('"p.p_partkey" $6)))
(let $25 '('('"_logical_id" '6148) '('"_id" '"3b0b6396-b886632b-dbb0797-781dde5e") '('"_wide_channels" $24)))
(let $26 (DqPhyStage '($14) (lambda '($56) (block '(
  (let $57 (NarrowSqueezeToDict (ToFlow $56) (lambda '($58) $58) (lambda '($59) (AsStruct '('"p_partkey" $59))) $15))
  (return (FromFlow (FlatMap $57 (lambda '($60) (block '(
    (let $61 '('"l_extendedprice" '"l_partkey" '"l_quantity"))
    (let $62 (YtReadTable! world $1 '((YtSection '((YtPath $20 $61 (Void) (Void))) '()))))
    (let $63 '('0 '0 '1 '1 '2 '2))
    (return (MapJoinCore (DqReadWideWrap $62 '()) $60 'Inner $21 $5 $63 '('"p_partkey" '3) '('"l.l_partkey") $22))
  ))))))
))) $25))
(let $27 (Uint64 '1))
(let $28 '('"l_partkey" $6))
(let $29 '('('"_logical_id" '6052) '('"_id" '"80f1095e-71664465-7a7ae619-310bba91") '('"_wide_channels" (StructType '('_yql_agg_0 (TupleType $23 (DataType 'Uint64))) $28))))
(let $30 (DqPhyStage '() (lambda '() (block '(
  (let $64 (YtReadTable! world $1 '((YtSection '((YtPath $20 '('"l_partkey" '"l_quantity") (Void) (Void))) '()))))
  (let $65 (lambda '($70 $71 $72) $72 $27))
  (let $66 (lambda '($73 $74 $75 $76 $77) (AggrAdd $76 $75) (Inc $77)))
  (let $67 (lambda '($78 $79 $80) '($79 $80) $78))
  (return (DqPhyHashCombine (WideToBlocks (FromFlow (DqReadWideWrap $64 '()))) '-1073741824 (lambda '($68 $69) $68) $65 $66 $67))
))) $29))
(let $31 (DqCnHashShuffle (TDqOutput $30 '0) $21 '0 '"HashV2"))
(let $32 '('('"_logical_id" '6191) '('"_id" '"5fb95b1d-5e31a9de-d080222c-f3ade035") '('"_partition_mode" '"aggregate") '('"_wide_channels" (StructType '('Avg0 $23) $28))))
(let $33 (DqPhyStage '($31) (lambda '($81) (block '(
  (let $82 (NarrowSqueezeToDict (ToFlow (WideFromBlocks $81)) (lambda '($88 $89) $89) (lambda '($90 $91) (AsStruct '('_yql_agg_0 $90) '('"l_partkey" $91))) '('Auto 'Many)))
  (let $83 (lambda '($94) (Member $94 '_yql_agg_0) (Member $94 '"l_partkey")))
  (let $84 (lambda '($95 $96) (Nth $95 '0) (Nth $95 '1) $96))
  (let $85 (lambda '($102 $103 $104 $105 $106) (AggrAdd (Nth $102 '0) $104) (AggrAdd (Nth $102 '1) $105) $106))
  (let $86 (WideCondense1 (ExpandMap (OrderedFlatMap $82 (lambda '($92) (OrderedFlatMap (DictPayloads $92) (lambda '($93) $93)))) $83) $84 (lambda '($97 $98 $99 $100 $101) (AggrNotEquals $98 $101)) $85))
  (let $87 (lambda '($107 $108 $109) (Div $107 $108) $109))
  (return (FromFlow (WideMap $86 $87)))
))) $32))
(let $34 (DqCnMap (TDqOutput $26 '0)))
(let $35 (DqCnBroadcast (TDqOutput $33 '0)))
(let $36 (Bool 'false))
(let $37 (lambda '($137) $137))
(let $38 '('('"_logical_id" '6517) '('"_id" '"f0529310-714da305-582aaf03-25608c45") '('"_wide_channels" (StructType '('_yql_agg_0 $23)))))
(let $39 (DqPhyStage '($34 $35) (lambda '($110 $111) (block '(
  (let $112 (NarrowSqueezeToDict (ToFlow $111) (lambda '($115 $116) $116) (lambda '($117 $118) (AsStruct '('Avg0 $117) '('"l_partkey" $118))) $15))
  (let $113 '"j.l_extendedprice")
  (let $114 (Condense1 (NarrowMap (WideFilter (FlatMap $112 (lambda '($119) (block '(
    (let $120 (lambda '($122 $123 $124 $125) $122 $124 $125))
    (let $121 '('0 '0 '1 '1))
    (return (MapJoinCore (WideMap (ToFlow $110) $120) $119 'Inner '('2) '('"l_partkey") $121 '('Avg0 '2) $22 '('"t.l_partkey")))
  )))) (lambda '($126 $127 $128) (< $127 (* (Double '"0.2") $128)))) (lambda '($129 $130 $131) (AsStruct '($113 $129)))) (lambda '($132) (Member $132 $113)) (lambda '($133 $134) $36) (lambda '($135 $136) (AggrAdd (Member $135 $113) $136))))
  (return (FromFlow (ExpandMap $114 $37)))
))) $38))
(let $40 (DqCnUnionAll (TDqOutput $39 '0)))
(let $41 (DqPhyStage '($40) (lambda '($138) (block '(
  (let $139 (WideCondense1 (ToFlow $138) $37 (lambda '($141 $142) $36) (lambda '($143 $144) (AggrAdd $143 $144))))
  (let $140 (Condense (NarrowMap (Take $139 $27) (lambda '($145) (AsStruct '('Sum0 $145)))) (Nothing (OptionalType (StructType '('Sum0 $23)))) (lambda '($146 $147) $36) (lambda '($148 $149) (Just $148))))
  (return (FromFlow (Map $140 (lambda '($150) (AsStruct '('"avg_yearly" (/ (Member $150 'Sum0) (Double '"7.0"))))))))
))) '('('"_logical_id" '7853) '('"_id" '"ec9b7d7e-2b3302f2-ef281a01-ea867d40"))))
(let $42 '($13 $26 $30 $33 $39 $41))
(let $43 (DqCnResult (TDqOutput $41 '0) '('"avg_yearly")))
(return (KqpPhysicalQuery '((KqpPhysicalTx $42 '($43) '() '('('"type" '"generic")))) '((KqpTxResultBinding (ListType (StructType '('"avg_yearly" (OptionalType $23)))) '0 '0)) '('('"type" '"query"))))
)
