ulysses-you commented on a change in pull request #32391: URL: https://github.com/apache/spark/pull/32391#discussion_r623528281
########## File path: sql/core/src/main/scala/org/apache/spark/sql/execution/adaptive/DynamicJoinSelection.scala ########## @@ -0,0 +1,87 @@ +/* + * 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.optimizer.{BuildLeft, BuildRight, JoinSelectionHelper} +import org.apache.spark.sql.catalyst.planning.ExtractEquiJoinKeys +import org.apache.spark.sql.catalyst.plans.JoinType +import org.apache.spark.sql.catalyst.plans.logical.{BROADCAST, HintInfo, JoinHint, LogicalPlan, NO_BROADCAST_HASH, SHUFFLE_HASH} +import org.apache.spark.sql.catalyst.rules.Rule + +/** + * The main idea here is that make join config isolation between normal planner and aqe planner + * which shared the same code path. + * In order to achieve this we use a specific join hint in advance during AQE framework and then + * at JoinSelection side it will take and follow the inserted hint. + * + * For now we only support select strategy for equi join, and follow this order: + * 1. mark join as broadcast hash join if possible + * 2. mark join as shuffled hash join if possible + * + * Note that, we don't override join strategy if user specifies a join hint. + */ +object DynamicJoinSelection extends Rule[LogicalPlan] with JoinSelectionHelper { + final override val isAdaptive: Boolean = true + + private def insertJoinHint( Review comment: @cloud-fan Updated it. Added a flag `isAdaptive` in `Statistics` which you suggested to simplify the logic. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
