(
(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 '('('"unordered")))
(let $13 (Int32 '1))
(let $14 (DataType 'String))
(let $15 (StructType '('"p_brand" $14) '('"p_container" $14) '('"p_partkey" $6) '('"p_size" (DataType 'Int64))))
(let $16 '('('"_logical_id" '4580) '('"_id" '"5e6b314a-5afa8a87-7ab62b71-72d53db2") '('"_wide_channels" $15)))
(let $17 (DqPhyStage '() (lambda '() (block '(
  (let $32 '@@["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 $33 (YqlRowSpec '('NativeYtTypeFlags '0) $2 $3 '('Type $32) '('SortDirections '($4)) '('SortMembers $5) '('SortedBy $5) '('SortedByTypes '($6))))
  (let $34 (YtStat '('Id '"part") $8 '('DataSize '"239") $9 $10 $11))
  (let $35 (YtTable '"part" $33 $7 $34 '() (Void) (Void) '"/Root/plato"))
  (let $36 '('"p_brand" '"p_container" '"p_partkey" '"p_size"))
  (let $37 (YtReadTable! world $1 '((YtSection '((YtPath $35 $36 (Void) (Void))) $12))))
  (return (FromFlow (WideFilter (DqReadWideWrap $37 '()) (lambda '($38 $39 $40 $41) (>= $41 $13)))))
))) $16))
(let $18 (DqCnBroadcast (TDqOutput $17 '0)))
(let $19 (Bool 'false))
(let $20 (lambda '($102) $102))
(let $21 (DataType 'Double))
(let $22 '('('"_logical_id" '4850) '('"_id" '"4822bf6f-768cc722-d89f2346-631c403e") '('"_wide_channels" (StructType '('_yql_agg_0 $21)))))
(let $23 (DqPhyStage '($18) (lambda '($42) (block '(
  (let $43 '('Many 'Hashed 'Compact))
  (let $44 (NarrowSqueezeToDict (ToFlow $42) (lambda '($47 $48 $49 $50) $49) (lambda '($51 $52 $53 $54) (AsStruct '('"p_brand" $51) '('"p_container" $52) '('"p_partkey" $53) '('"p_size" $54))) $43))
  (let $45 '"l.l_extendedprice")
  (let $46 (Condense1 (NarrowMap (WideFilter (FlatMap $44 (lambda '($55) (block '(
    (let $56 '@@["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 $57 '('"l_orderkey" '"l_linenumber"))
    (let $58 (YqlRowSpec '('NativeYtTypeFlags '2) $2 $3 '('Type $56) '('SortDirections '($4 $4)) '('SortMembers $57) '('SortedBy $57) '('SortedByTypes '($6 $6))))
    (let $59 (YtStat '('Id '"lineitem") $8 '('DataSize '"343") $9 $10 $11))
    (let $60 (YtTable '"lineitem" $58 $7 $59 '() (Void) (Void) '"/Root/plato"))
    (let $61 '('"l_discount" '"l_extendedprice" '"l_partkey" '"l_quantity" '"l_shipinstruct" '"l_shipmode"))
    (let $62 (YtReadTable! world $1 '((YtSection '((YtPath $60 $61 (Void) (Void))) $12))))
    (let $63 (lambda '($72 $73 $74 $75 $76 $77) $72 $73 $74 $75))
    (let $64 '('0 '0 '1 '1 '3 '2))
    (let $65 '('"p_brand" '3 '"p_container" '4 '"p_size" '5))
    (return (MapJoinCore (WideMap (WideFilter (DqReadWideWrap $62 '()) (lambda '($66 $67 $68 $69 $70 $71) (And (Or (== $71 (String '"AIR")) (== $71 (String '"AIR REG"))) (== $70 (String '"DELIVER IN PERSON"))))) $63) $55 'Inner '('2) $5 $64 $65 '('"l.l_partkey") '('"p.p_partkey")))
  )))) (lambda '($78 $79 $80 $81 $82 $83) (block '(
    (let $84 (Or (== $82 (String '"SM CASE")) (== $82 (String '"SM BOX")) (== $82 (String '"SM PACK")) (== $82 (String '"SM PKG"))))
    (let $85 (Int32 '"17"))
    (let $86 (And (== $81 (String '"Brand#23")) $84 (>= $80 (Int32 '"7")) (<= $80 $85) (<= $83 (Int32 '5))))
    (let $87 (Or (== $82 (String '"MED BAG")) (== $82 (String '"MED BOX")) (== $82 (String '"MED PKG")) (== $82 (String '"MED PACK"))))
    (let $88 (And (== $81 (String '"Brand#15")) $87 (>= $80 $85) (<= $80 (Int32 '"27")) (<= $83 (Int32 '"10"))))
    (let $89 (Or (== $82 (String '"LG CASE")) (== $82 (String '"LG BOX")) (== $82 (String '"LG PACK")) (== $82 (String '"LG PKG"))))
    (let $90 (And (== $81 (String '"Brand#44")) $89 (>= $80 (Int32 '"25")) (<= $80 (Int32 '"35")) (<= $83 (Int32 '"15"))))
    (return (Or $86 $88 $90))
  )))) (lambda '($91 $92 $93 $94 $95 $96) (AsStruct '('"l.l_discount" $91) '($45 $92)))) (lambda '($97) (* (Member $97 $45) (- $13 (Member $97 '"l.l_discount")))) (lambda '($98 $99) $19) (lambda '($100 $101) (AggrAdd (* (Member $100 $45) (- $13 (Member $100 '"l.l_discount"))) $101))))
  (return (FromFlow (ExpandMap $46 $20)))
))) $22))
(let $24 (DqCnUnionAll (TDqOutput $23 '0)))
(let $25 (StructType '('Sum0 $21)))
(let $26 '('('"_logical_id" '5933) '('"_id" '"9fd2e073-7105ceb7-b6a12398-ecd35b30") '('"_partition_mode" '"aggregate") '('"_wide_channels" $25)))
(let $27 (DqPhyStage '($24) (lambda '($103) (FromFlow (WideCondense1 (ToFlow $103) $20 (lambda '($104 $105) $19) (lambda '($106 $107) (AggrAdd $106 $107))))) $26))
(let $28 (DqCnUnionAll (TDqOutput $27 '0)))
(let $29 (DqPhyStage '($28) (lambda '($108) (block '(
  (let $109 (Condense (NarrowMap (ToFlow $108) (lambda '($110) (AsStruct '('Sum0 $110)))) (List (ListType $25)) (lambda '($111 $112) $19) (lambda '($113 $114) (AsList $113))))
  (return (FromFlow (Map $109 (lambda '($115) (AsStruct '('"revenue" (Member (ToOptional $115) 'Sum0)))))))
))) '('('"_logical_id" '5987) '('"_id" '"21cbaaee-ac49ffbe-95b8994e-b61501a"))))
(let $30 '($17 $23 $27 $29))
(let $31 (DqCnResult (TDqOutput $29 '0) '('"revenue")))
(return (KqpPhysicalQuery '((KqpPhysicalTx $30 '($31) '() '('('"type" '"generic")))) '((KqpTxResultBinding (ListType (StructType '('"revenue" (OptionalType $21)))) '0 '0)) '('('"type" '"query"))))
)
