cloud-fan commented on a change in pull request #32355:
URL: https://github.com/apache/spark/pull/32355#discussion_r681628239



##########
File path: 
sql/core/src/main/scala/org/apache/spark/sql/execution/SparkStrategies.scala
##########
@@ -139,6 +141,36 @@ abstract class SparkStrategies extends 
QueryPlanner[SparkPlan] {
   object JoinSelection extends Strategy
     with PredicateHelper
     with JoinSelectionHelper {
+    private val hintErrorHandler = conf.hintErrorHandler
+
+    private def checkHintBuildSide(
+        onlyLookingAtHint: Boolean,
+        buildSide: Option[BuildSide],
+        joinType: JoinType,
+        hint: JoinHint,
+        isBroadcast: Boolean): Unit = {
+      if (onlyLookingAtHint && buildSide.isEmpty) {
+        if ((isBroadcast && hintToBroadcastLeft(hint)) ||
+          (!isBroadcast && hintToShuffleHashJoinLeft(hint))) {
+          assert(hint.leftHint.isDefined)
+          hintErrorHandler.joinHintNotSupported(hint.leftHint.get,
+            s"build left for ${joinType.sql.toLowerCase(Locale.ROOT)} join")
+        } else if ((isBroadcast && hintToBroadcastRight(hint)) ||
+          (!isBroadcast && hintToShuffleHashJoinRight(hint))) {
+          assert(hint.rightHint.isDefined)
+          hintErrorHandler.joinHintNotSupported(hint.rightHint.get,
+            s"build right for ${joinType.sql.toLowerCase(Locale.ROOT)} join")
+        }
+      }
+    }
+
+    private def checkHintNonEquiJoin(hint: JoinHint): Unit = {
+      if (hintToShuffleHashJoin(hint) || hintToSortMergeJoin(hint)) {
+        assert(hint.leftHint.orElse(hint.rightHint).isDefined)
+        
hintErrorHandler.joinHintNotSupported(hint.leftHint.orElse(hint.rightHint).get,
+          "equi join keys is not existed")

Review comment:
       `no equi-join keys`




-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to