IMPALA-5894: [DOCS] Clarify placement of STRAIGHT_JOIN hint

"immediately after the SELECT keyword" was mentioned in a
few places for STRAIGHT_JOIN. I reworded all instances to
mention that [DISTINCT | ALL] can also come before the
hint name.

Change-Id: I3cac1afccc132f389b2017ad217fdf7e7b04513a
Reviewed-on: http://gerrit.cloudera.org:8080/8031
Reviewed-by: Alex Behm <[email protected]>
Tested-by: Impala Public Jenkins


Project: http://git-wip-us.apache.org/repos/asf/incubator-impala/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-impala/commit/03571788
Tree: http://git-wip-us.apache.org/repos/asf/incubator-impala/tree/03571788
Diff: http://git-wip-us.apache.org/repos/asf/incubator-impala/diff/03571788

Branch: refs/heads/master
Commit: 03571788be44d903a81dc092a447c74ccb9bac76
Parents: 39f23bb
Author: John Russell <[email protected]>
Authored: Mon Sep 11 12:05:41 2017 -0700
Committer: Impala Public Jenkins <[email protected]>
Committed: Tue Sep 12 07:02:09 2017 +0000

----------------------------------------------------------------------
 docs/shared/impala_common.xml     |  2 +-
 docs/topics/impala_hints.xml      |  3 ++-
 docs/topics/impala_perf_joins.xml | 12 +++++++++---
 3 files changed, 12 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/03571788/docs/shared/impala_common.xml
----------------------------------------------------------------------
diff --git a/docs/shared/impala_common.xml b/docs/shared/impala_common.xml
index 9d6f72b..f31bdf0 100644
--- a/docs/shared/impala_common.xml
+++ b/docs/shared/impala_common.xml
@@ -2722,7 +2722,7 @@ flight_num:           INT32 SNAPPY DO:83456393 
FPO:83488603 SZ:10216514/11474301
         are supported in all Impala versions. The <codeph>CROSS JOIN</codeph> 
operator is available in Impala 1.2.2
         and higher. During performance tuning, you can override the reordering 
of join clauses that Impala does
         internally by including the keyword <codeph>STRAIGHT_JOIN</codeph> 
immediately after the
-        <codeph>SELECT</codeph> keyword
+        <codeph>SELECT</codeph> and any <codeph>DISTINCT</codeph> or 
<codeph>ALL</codeph> keywords.
       </p>
 
       <p id="catalog_server_124">

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/03571788/docs/topics/impala_hints.xml
----------------------------------------------------------------------
diff --git a/docs/topics/impala_hints.xml b/docs/topics/impala_hints.xml
index 18b0dc6..843d9be 100644
--- a/docs/topics/impala_hints.xml
+++ b/docs/topics/impala_hints.xml
@@ -131,7 +131,8 @@ INSERT <varname>insert_clauses</varname>
 
     <p>
       With both forms of hint syntax, include the 
<codeph>STRAIGHT_JOIN</codeph>
-      keyword immediately after the <codeph>SELECT</codeph> keyword to prevent 
Impala from
+      keyword immediately after the <codeph>SELECT</codeph> and any
+      <codeph>DISTINCT</codeph> or <codeph>ALL</codeph> keywords to prevent 
Impala from
       reordering the tables in a way that makes the join-related hints 
ineffective.
     </p>
 

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/03571788/docs/topics/impala_perf_joins.xml
----------------------------------------------------------------------
diff --git a/docs/topics/impala_perf_joins.xml 
b/docs/topics/impala_perf_joins.xml
index 116ba75..9cae4ef 100644
--- a/docs/topics/impala_perf_joins.xml
+++ b/docs/topics/impala_perf_joins.xml
@@ -57,8 +57,9 @@ under the License.
     <p>
       If statistics are not available for all the tables in the join query, or 
if Impala chooses a join order that
       is not the most efficient, you can override the automatic join order 
optimization by specifying the
-      <codeph>STRAIGHT_JOIN</codeph> keyword immediately after the 
<codeph>SELECT</codeph> keyword. In this case,
-      Impala uses the order the tables appear in the query to guide how the 
joins are processed.
+      <codeph>STRAIGHT_JOIN</codeph> keyword immediately after the 
<codeph>SELECT</codeph> and any <codeph>DISTINCT</codeph>
+      or <codeph>ALL</codeph> keywords. In this case, Impala uses the order 
the tables appear in the query to guide how the
+      joins are processed.
     </p>
 
     <p>
@@ -149,7 +150,8 @@ under the License.
       <p>
         If an Impala join query is inefficient because of outdated statistics 
or unexpected data distribution, you
         can keep Impala from reordering the joined tables by using the 
<codeph>STRAIGHT_JOIN</codeph> keyword
-        immediately after the <codeph>SELECT</codeph> keyword. The 
<codeph>STRAIGHT_JOIN</codeph> keyword turns off
+        immediately after the <codeph>SELECT</codeph> and any 
<codeph>DISTINCT</codeph> or <codeph>ALL</codeph>
+        keywords. The <codeph>STRAIGHT_JOIN</codeph> keyword turns off
         the reordering of join clauses that Impala does internally, and 
produces a plan that relies on the join
         clauses being ordered optimally in the query text. In this case, 
rewrite the query so that the largest
         table is on the left, followed by the next largest, and so on until 
the smallest table is on the right.
@@ -163,6 +165,10 @@ under the License.
       </p>
 
 <codeblock>select straight_join x from medium join small join (select * from 
big where c1 &lt; 10) as big
+  where medium.id = small.id and small.id = big.id;
+
+-- If the query contains [DISTINCT | ALL], the hint goes after those keywords.
+select distinct straight_join x from medium join small join (select * from big 
where c1 &lt; 10) as big
   where medium.id = small.id and small.id = big.id;</codeblock>
     </conbody>
   </concept>

Reply via email to