Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -349,14 +349,11 @@ object JoinReorderDP extends PredicateHelper with Logging {
}

def betterThan(other: JoinPlan, conf: SQLConf): Boolean = {
if (other.planCost.card == 0 || other.planCost.size == 0) {
false
} else {
val relativeRows = BigDecimal(this.planCost.card) / BigDecimal(other.planCost.card)
val relativeSize = BigDecimal(this.planCost.size) / BigDecimal(other.planCost.size)
relativeRows * conf.joinReorderCardWeight +
relativeSize * (1 - conf.joinReorderCardWeight) < 1
}
val oldCost = BigDecimal(this.planCost.card) * conf.joinReorderCardWeight +
BigDecimal(this.planCost.size) * (1 - conf.joinReorderCardWeight)
val newCost = BigDecimal(other.planCost.card) * conf.joinReorderCardWeight +
Comment thread
tanelk marked this conversation as resolved.
Outdated
BigDecimal(other.planCost.size) * (1 - conf.joinReorderCardWeight)
newCost < oldCost
}
}
}
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,81 +1,90 @@
TakeOrderedAndProject [cd_gender,cd_marital_status,cd_education_status,cd_purchase_estimate,cd_credit_rating,cd_dep_count,cd_dep_employed_count,cd_dep_college_count,cnt1,cnt2,cnt3,cnt4,cnt5,cnt6]
WholeStageCodegen (14)
WholeStageCodegen (17)
HashAggregate [cd_gender,cd_marital_status,cd_education_status,cd_purchase_estimate,cd_credit_rating,cd_dep_count,cd_dep_employed_count,cd_dep_college_count,count] [count(1),cnt1,cnt2,cnt3,cnt4,cnt5,cnt6,count]
InputAdapter
Exchange [cd_gender,cd_marital_status,cd_education_status,cd_purchase_estimate,cd_credit_rating,cd_dep_count,cd_dep_employed_count,cd_dep_college_count] #1
WholeStageCodegen (13)
WholeStageCodegen (16)
HashAggregate [cd_gender,cd_marital_status,cd_education_status,cd_purchase_estimate,cd_credit_rating,cd_dep_count,cd_dep_employed_count,cd_dep_college_count] [count,count]
Project [cd_gender,cd_marital_status,cd_education_status,cd_purchase_estimate,cd_credit_rating,cd_dep_count,cd_dep_employed_count,cd_dep_college_count]
BroadcastHashJoin [c_current_cdemo_sk,cd_demo_sk]
InputAdapter
BroadcastExchange #2
WholeStageCodegen (12)
Project [c_current_cdemo_sk]
BroadcastHashJoin [c_current_addr_sk,ca_address_sk]
Project [c_current_cdemo_sk,c_current_addr_sk]
InputAdapter
SortMergeJoin [c_customer_sk,customer_sk]
SortMergeJoin [c_customer_sk,customer_sk]
WholeStageCodegen (2)
Sort [c_customer_sk]
InputAdapter
Exchange [c_customer_sk] #3
WholeStageCodegen (1)
Filter [c_customer_sk,c_current_addr_sk,c_current_cdemo_sk]
ColumnarToRow
InputAdapter
Scan parquet default.customer [c_customer_sk,c_current_cdemo_sk,c_current_addr_sk]
WholeStageCodegen (7)
Sort [customer_sk]
InputAdapter
Exchange [customer_sk] #4
Union
WholeStageCodegen (4)
Project [ws_bill_customer_sk]
BroadcastHashJoin [ws_sold_date_sk,d_date_sk]
Filter [ws_sold_date_sk,ws_bill_customer_sk]
ColumnarToRow
InputAdapter
Scan parquet default.web_sales [ws_sold_date_sk,ws_bill_customer_sk]
InputAdapter
BroadcastExchange #5
WholeStageCodegen (3)
Project [d_date_sk]
Filter [d_year,d_moy,d_date_sk]
ColumnarToRow
InputAdapter
Scan parquet default.date_dim [d_date_sk,d_year,d_moy]
WholeStageCodegen (6)
Project [cs_ship_customer_sk]
BroadcastHashJoin [cs_sold_date_sk,d_date_sk]
Filter [cs_sold_date_sk,cs_ship_customer_sk]
ColumnarToRow
InputAdapter
Scan parquet default.catalog_sales [cs_sold_date_sk,cs_ship_customer_sk]
InputAdapter
ReusedExchange [d_date_sk] #5
WholeStageCodegen (10)
Sort [customer_sk]
InputAdapter
Exchange [customer_sk] #6
WholeStageCodegen (9)
Project [ss_customer_sk]
BroadcastHashJoin [ss_sold_date_sk,d_date_sk]
Filter [ss_sold_date_sk,ss_customer_sk]
ColumnarToRow
InputAdapter
Scan parquet default.store_sales [ss_sold_date_sk,ss_customer_sk]
InputAdapter
ReusedExchange [d_date_sk] #5
BroadcastHashJoin [c_current_addr_sk,ca_address_sk]
Project [c_current_addr_sk,cd_gender,cd_marital_status,cd_education_status,cd_purchase_estimate,cd_credit_rating,cd_dep_count,cd_dep_employed_count,cd_dep_college_count]
SortMergeJoin [c_current_cdemo_sk,cd_demo_sk]
InputAdapter
WholeStageCodegen (12)
Sort [c_current_cdemo_sk]
InputAdapter
BroadcastExchange #7
Exchange [c_current_cdemo_sk] #2
WholeStageCodegen (11)
Project [ca_address_sk]
Filter [ca_county,ca_address_sk]
ColumnarToRow
InputAdapter
Scan parquet default.customer_address [ca_address_sk,ca_county]
Filter [cd_demo_sk]
ColumnarToRow
Project [c_current_cdemo_sk,c_current_addr_sk]
InputAdapter
SortMergeJoin [c_customer_sk,customer_sk]
SortMergeJoin [c_customer_sk,customer_sk]
WholeStageCodegen (2)
Sort [c_customer_sk]
InputAdapter
Exchange [c_customer_sk] #3
WholeStageCodegen (1)
Filter [c_customer_sk,c_current_addr_sk,c_current_cdemo_sk]
ColumnarToRow
InputAdapter
Scan parquet default.customer [c_customer_sk,c_current_cdemo_sk,c_current_addr_sk]
WholeStageCodegen (7)
Sort [customer_sk]
InputAdapter
Exchange [customer_sk] #4
Union
WholeStageCodegen (4)
Project [ws_bill_customer_sk]
BroadcastHashJoin [ws_sold_date_sk,d_date_sk]
Filter [ws_sold_date_sk,ws_bill_customer_sk]
ColumnarToRow
InputAdapter
Scan parquet default.web_sales [ws_sold_date_sk,ws_bill_customer_sk]
InputAdapter
BroadcastExchange #5
WholeStageCodegen (3)
Project [d_date_sk]
Filter [d_year,d_moy,d_date_sk]
ColumnarToRow
InputAdapter
Scan parquet default.date_dim [d_date_sk,d_year,d_moy]
WholeStageCodegen (6)
Project [cs_ship_customer_sk]
BroadcastHashJoin [cs_sold_date_sk,d_date_sk]
Filter [cs_sold_date_sk,cs_ship_customer_sk]
ColumnarToRow
InputAdapter
Scan parquet default.catalog_sales [cs_sold_date_sk,cs_ship_customer_sk]
InputAdapter
ReusedExchange [d_date_sk] #5
WholeStageCodegen (10)
Sort [customer_sk]
InputAdapter
Exchange [customer_sk] #6
WholeStageCodegen (9)
Project [ss_customer_sk]
BroadcastHashJoin [ss_sold_date_sk,d_date_sk]
Filter [ss_sold_date_sk,ss_customer_sk]
ColumnarToRow
InputAdapter
Scan parquet default.store_sales [ss_sold_date_sk,ss_customer_sk]
InputAdapter
ReusedExchange [d_date_sk] #5
InputAdapter
Scan parquet default.customer_demographics [cd_demo_sk,cd_gender,cd_marital_status,cd_education_status,cd_purchase_estimate,cd_credit_rating,cd_dep_count,cd_dep_employed_count,cd_dep_college_count]
WholeStageCodegen (14)
Sort [cd_demo_sk]
InputAdapter
Exchange [cd_demo_sk] #7
WholeStageCodegen (13)
Filter [cd_demo_sk]
ColumnarToRow
InputAdapter
Scan parquet default.customer_demographics [cd_demo_sk,cd_gender,cd_marital_status,cd_education_status,cd_purchase_estimate,cd_credit_rating,cd_dep_count,cd_dep_employed_count,cd_dep_college_count]
InputAdapter
BroadcastExchange #8
WholeStageCodegen (15)
Project [ca_address_sk]
Filter [ca_county,ca_address_sk]
ColumnarToRow
InputAdapter
Scan parquet default.customer_address [ca_address_sk,ca_county]
Loading