== Physical Plan ==
* Sort (16)
+- Exchange (15)
   +- * Project (14)
      +- * BroadcastHashJoin Inner BuildRight (13)
         :- * Filter (3)
         :  +- * ColumnarToRow (2)
         :     +- Scan parquet spark_catalog.default.supplier (1)
         +- BroadcastExchange (12)
            +- * Filter (11)
               +- * HashAggregate (10)
                  +- Exchange (9)
                     +- * HashAggregate (8)
                        +- * Project (7)
                           +- * Filter (6)
                              +- * ColumnarToRow (5)
                                 +- Scan parquet spark_catalog.default.lineitem (4)


(1) Scan parquet spark_catalog.default.supplier
Output [4]: [s_suppkey#1, s_name#2, s_address#3, s_phone#4]
Batched: true
Location [not included in comparison]/{warehouse_dir}/supplier]
PushedFilters: [IsNotNull(s_suppkey)]
ReadSchema: struct<s_suppkey:bigint,s_name:string,s_address:string,s_phone:string>

(2) ColumnarToRow [codegen id : 3]
Input [4]: [s_suppkey#1, s_name#2, s_address#3, s_phone#4]

(3) Filter [codegen id : 3]
Input [4]: [s_suppkey#1, s_name#2, s_address#3, s_phone#4]
Condition : isnotnull(s_suppkey#1)

(4) Scan parquet spark_catalog.default.lineitem
Output [4]: [l_suppkey#5, l_extendedprice#6, l_discount#7, l_shipdate#8]
Batched: true
Location [not included in comparison]/{warehouse_dir}/lineitem]
PushedFilters: [IsNotNull(l_shipdate), GreaterThanOrEqual(l_shipdate,1996-01-01), LessThan(l_shipdate,1996-04-01), IsNotNull(l_suppkey)]
ReadSchema: struct<l_suppkey:bigint,l_extendedprice:decimal(10,0),l_discount:decimal(10,0),l_shipdate:date>

(5) ColumnarToRow [codegen id : 1]
Input [4]: [l_suppkey#5, l_extendedprice#6, l_discount#7, l_shipdate#8]

(6) Filter [codegen id : 1]
Input [4]: [l_suppkey#5, l_extendedprice#6, l_discount#7, l_shipdate#8]
Condition : (((isnotnull(l_shipdate#8) AND (l_shipdate#8 >= 1996-01-01)) AND (l_shipdate#8 < 1996-04-01)) AND isnotnull(l_suppkey#5))

(7) Project [codegen id : 1]
Output [3]: [l_suppkey#5, l_extendedprice#6, l_discount#7]
Input [4]: [l_suppkey#5, l_extendedprice#6, l_discount#7, l_shipdate#8]

(8) HashAggregate [codegen id : 1]
Input [3]: [l_suppkey#5, l_extendedprice#6, l_discount#7]
Keys [1]: [l_suppkey#5]
Functions [1]: [partial_sum((l_extendedprice#6 * (1 - l_discount#7)))]
Aggregate Attributes [2]: [sum#9, isEmpty#10]
Results [3]: [l_suppkey#5, sum#11, isEmpty#12]

(9) Exchange
Input [3]: [l_suppkey#5, sum#11, isEmpty#12]
Arguments: hashpartitioning(l_suppkey#5, 5), ENSURE_REQUIREMENTS, [plan_id=1]

(10) HashAggregate [codegen id : 2]
Input [3]: [l_suppkey#5, sum#11, isEmpty#12]
Keys [1]: [l_suppkey#5]
Functions [1]: [sum((l_extendedprice#6 * (1 - l_discount#7)))]
Aggregate Attributes [1]: [sum((l_extendedprice#6 * (1 - l_discount#7)))#13]
Results [2]: [l_suppkey#5 AS supplier_no#14, sum((l_extendedprice#6 * (1 - l_discount#7)))#13 AS total_revenue#15]

(11) Filter [codegen id : 2]
Input [2]: [supplier_no#14, total_revenue#15]
Condition : (isnotnull(total_revenue#15) AND (total_revenue#15 = Subquery scalar-subquery#16, [id=#2]))

(12) BroadcastExchange
Input [2]: [supplier_no#14, total_revenue#15]
Arguments: HashedRelationBroadcastMode(List(input[0, bigint, true]),false), [plan_id=3]

(13) BroadcastHashJoin [codegen id : 3]
Left keys [1]: [s_suppkey#1]
Right keys [1]: [supplier_no#14]
Join type: Inner
Join condition: None

(14) Project [codegen id : 3]
Output [5]: [s_suppkey#1, s_name#2, s_address#3, s_phone#4, total_revenue#15]
Input [6]: [s_suppkey#1, s_name#2, s_address#3, s_phone#4, supplier_no#14, total_revenue#15]

(15) Exchange
Input [5]: [s_suppkey#1, s_name#2, s_address#3, s_phone#4, total_revenue#15]
Arguments: rangepartitioning(s_suppkey#1 ASC NULLS FIRST, 5), ENSURE_REQUIREMENTS, [plan_id=4]

(16) Sort [codegen id : 4]
Input [5]: [s_suppkey#1, s_name#2, s_address#3, s_phone#4, total_revenue#15]
Arguments: [s_suppkey#1 ASC NULLS FIRST], true, 0

===== Subqueries =====

Subquery:1 Hosting operator id = 11 Hosting Expression = Subquery scalar-subquery#16, [id=#2]
* HashAggregate (26)
+- Exchange (25)
   +- * HashAggregate (24)
      +- * HashAggregate (23)
         +- Exchange (22)
            +- * HashAggregate (21)
               +- * Project (20)
                  +- * Filter (19)
                     +- * ColumnarToRow (18)
                        +- Scan parquet spark_catalog.default.lineitem (17)


(17) Scan parquet spark_catalog.default.lineitem
Output [4]: [l_suppkey#17, l_extendedprice#18, l_discount#19, l_shipdate#20]
Batched: true
Location [not included in comparison]/{warehouse_dir}/lineitem]
PushedFilters: [IsNotNull(l_shipdate), GreaterThanOrEqual(l_shipdate,1996-01-01), LessThan(l_shipdate,1996-04-01)]
ReadSchema: struct<l_suppkey:bigint,l_extendedprice:decimal(10,0),l_discount:decimal(10,0),l_shipdate:date>

(18) ColumnarToRow [codegen id : 1]
Input [4]: [l_suppkey#17, l_extendedprice#18, l_discount#19, l_shipdate#20]

(19) Filter [codegen id : 1]
Input [4]: [l_suppkey#17, l_extendedprice#18, l_discount#19, l_shipdate#20]
Condition : ((isnotnull(l_shipdate#20) AND (l_shipdate#20 >= 1996-01-01)) AND (l_shipdate#20 < 1996-04-01))

(20) Project [codegen id : 1]
Output [3]: [l_suppkey#17, l_extendedprice#18, l_discount#19]
Input [4]: [l_suppkey#17, l_extendedprice#18, l_discount#19, l_shipdate#20]

(21) HashAggregate [codegen id : 1]
Input [3]: [l_suppkey#17, l_extendedprice#18, l_discount#19]
Keys [1]: [l_suppkey#17]
Functions [1]: [partial_sum((l_extendedprice#18 * (1 - l_discount#19)))]
Aggregate Attributes [2]: [sum#21, isEmpty#22]
Results [3]: [l_suppkey#17, sum#23, isEmpty#24]

(22) Exchange
Input [3]: [l_suppkey#17, sum#23, isEmpty#24]
Arguments: hashpartitioning(l_suppkey#17, 5), ENSURE_REQUIREMENTS, [plan_id=5]

(23) HashAggregate [codegen id : 2]
Input [3]: [l_suppkey#17, sum#23, isEmpty#24]
Keys [1]: [l_suppkey#17]
Functions [1]: [sum((l_extendedprice#18 * (1 - l_discount#19)))]
Aggregate Attributes [1]: [sum((l_extendedprice#18 * (1 - l_discount#19)))#13]
Results [1]: [sum((l_extendedprice#18 * (1 - l_discount#19)))#13 AS total_revenue#25]

(24) HashAggregate [codegen id : 2]
Input [1]: [total_revenue#25]
Keys: []
Functions [1]: [partial_max(total_revenue#25)]
Aggregate Attributes [1]: [max#26]
Results [1]: [max#27]

(25) Exchange
Input [1]: [max#27]
Arguments: SinglePartition, ENSURE_REQUIREMENTS, [plan_id=6]

(26) HashAggregate [codegen id : 3]
Input [1]: [max#27]
Keys: []
Functions [1]: [max(total_revenue#25)]
Aggregate Attributes [1]: [max(total_revenue#25)#28]
Results [1]: [max(total_revenue#25)#28 AS max(total_revenue)#29]


