You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2020/03/18 04:41:02 UTC

[GitHub] [spark] maropu commented on a change in pull request #27935: [SPARK-25121][SQL] Supports multi-part table names for broadcast hint resolution

maropu commented on a change in pull request #27935: [SPARK-25121][SQL] Supports multi-part table names for broadcast hint resolution
URL: https://github.com/apache/spark/pull/27935#discussion_r394103417
 
 

 ##########
 File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/ResolveHints.scala
 ##########
 @@ -64,31 +64,63 @@ object ResolveHints {
             _.toUpperCase(Locale.ROOT)).contains(hintName.toUpperCase(Locale.ROOT))))
     }
 
+    // This method checks if given multi-part identifiers are matched with each other.
+    // The [[ResolveJoinStrategyHints]] rule is applied before the resolution batch
+    // in the analyzer and we cannot semantically compare them at this stage.
+    // Therefore, we follow simple rules; the process is independent of a session catalog
+    // (`currentDb` in [[SessionCatalog]]) and it just compares them literally.
+    //
+    // Specifically, we follow simple three rules below:
+    //
+    //  1. they match if an identifier in a hint only has one part and it is the same with
+    //     a relation name in a query. If a relation has a namespace (`db1.t`), we just ignore it.
+    //     For example, in a query `SELECT /* BROADCAST(t) */ * FROM db1.t JOIN t`,
+    //     the broadcast hint will match both tables, `db1.t` and `t`.
+    //
+    //  2. they match if an identifier in a hint has two parts and it is the same with
+    //     a two part identifier (name and namespace) in a relation.
+    //     For example, in a query `SELECT /* BROADCAST(default.t) */ * FROM default.t JOIN t`,
+    //     the broadcast hint will match the left-side table only, `default.t`.
+    //
+    //  3. otherwise, no match happens.
 
 Review comment:
   I re-read your comments again and summarized up them above. If I misunderstand something, please let me know. @dongjoon-hyun @cloud-fan 

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org