Uploaded image for project: 'IMPALA'
  1. IMPALA
  2. IMPALA-6083

Clarify scope of STRAIGHT_JOIN query hint in Impala docs

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • Impala 2.10.0
    • Impala 2.10.0
    • Docs
    • None
    • ghx-label-9

    Description

      The documentation for STRAIGHT_JOIN is missing one very important detail:
      The scope of the hint is limited to the FROM clause of the query block where the hint appears. In particular, the hint does not apply recursively to all subqueries.

      Existing docs are here:
      https://impala.incubator.apache.org/docs/build/html/topics/impala_perf_joins.html

      Examples
      1. The hint here will prevent reordering of "v1" and "v2", but the joins between "t1" and "t2" and "t3" and "t4" can still be reordered.

      select /* +straight_join */ count(*) from
      (select t1.id as id from t1 join t2 on t1.id = t2.id) v1
      join
      (select t3.id as id from t3 join t4 on t3.id = t4.id) v2
      on (v1.id = v2.id)
      

      2. Fully hinted query. No join ordering is applied whatsoever.

      select /* +straight_join */ count(*) from
      (select /* +straight_join */ t1.id as id from t1 join t2 on t1.id = t2.id) v1
      join
      (select /* +straight_join */ t3.id as id from t3 join t4 on t3.id = t4.id) v2
      on (v1.id = v2.id)
      

      Attachments

        Activity

          People

            jrussell John Russell
            alex.behm Alexander Behm
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: