-
Notifications
You must be signed in to change notification settings - Fork 447
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
132 additions
and
229 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 0 additions & 40 deletions
40
shims/spark32/src/main/scala/org/apache/spark/sql/execution/JoinSelectionShim.scala
This file was deleted.
Oops, something went wrong.
45 changes: 45 additions & 0 deletions
45
.../spark32/src/main/scala/org/apache/spark/sql/execution/adaptive/GlutenCostEvaluator.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.apache.spark.sql.execution.adaptive | ||
|
||
import org.apache.spark.sql.execution.SparkPlan | ||
import org.apache.spark.sql.execution.joins.ShuffledJoin | ||
|
||
/** | ||
* This [[CostEvaluator]] is to force use the new physical plan when AQE's new physical plan | ||
* contains [[ShuffledJoin]] and cost is the same. | ||
*/ | ||
case class GlutenCostEvaluator() extends CostEvaluator { | ||
override def evaluateCost(plan: SparkPlan): Cost = { | ||
val simpleCost = | ||
SimpleCostEvaluator.evaluateCost(plan).asInstanceOf[SimpleCost] | ||
var cost = simpleCost.value * 2 | ||
if (existsShuffledJoin(plan)) { | ||
plan.logicalLink.map(_.stats.isRuntime) match { | ||
case Some(true) => cost -= 1 | ||
case _ => | ||
} | ||
} | ||
SimpleCost(cost) | ||
} | ||
|
||
def existsShuffledJoin(plan: SparkPlan): Boolean = if (plan.isInstanceOf[ShuffledJoin]) { | ||
true | ||
} else { | ||
plan.children.exists(existsShuffledJoin(_)) | ||
} | ||
} |
51 changes: 0 additions & 51 deletions
51
shims/spark33/src/main/scala/org/apache/spark/sql/execution/JoinSelectionShim.scala
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 0 additions & 51 deletions
51
shims/spark34/src/main/scala/org/apache/spark/sql/execution/JoinSelectionShim.scala
This file was deleted.
Oops, something went wrong.
42 changes: 42 additions & 0 deletions
42
.../spark34/src/main/scala/org/apache/spark/sql/execution/adaptive/GlutenCostEvaluator.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.apache.spark.sql.execution.adaptive | ||
|
||
import org.apache.spark.sql.catalyst.SQLConfHelper | ||
import org.apache.spark.sql.execution.SparkPlan | ||
import org.apache.spark.sql.execution.joins.ShuffledJoin | ||
import org.apache.spark.sql.internal.SQLConf | ||
|
||
/** | ||
* This [[CostEvaluator]] is to force use the new physical plan when AQE's new physical plan | ||
* contains [[ShuffledJoin]] and cost is the same. | ||
*/ | ||
case class GlutenCostEvaluator() extends CostEvaluator with SQLConfHelper { | ||
override def evaluateCost(plan: SparkPlan): Cost = { | ||
val forceOptimizeSkewedJoin = conf.getConf(SQLConf.ADAPTIVE_FORCE_OPTIMIZE_SKEWED_JOIN) | ||
val simpleCost = | ||
SimpleCostEvaluator(forceOptimizeSkewedJoin).evaluateCost(plan).asInstanceOf[SimpleCost] | ||
var cost = simpleCost.value * 2 | ||
if (plan.exists(_.isInstanceOf[ShuffledJoin])) { | ||
plan.logicalLink.map(_.stats.isRuntime) match { | ||
case Some(true) => cost -= 1 | ||
case _ => | ||
} | ||
} | ||
SimpleCost(cost) | ||
} | ||
} |
51 changes: 0 additions & 51 deletions
51
shims/spark35/src/main/scala/org/apache/spark/sql/execution/JoinSelectionShim.scala
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.