You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@impala.apache.org by "Quanlong Huang (Jira)" <ji...@apache.org> on 2020/01/10 10:13:00 UTC

[jira] [Created] (IMPALA-9286) Refactor the resolution of local views

Quanlong Huang created IMPALA-9286:
--------------------------------------

             Summary: Refactor the resolution of local views
                 Key: IMPALA-9286
                 URL: https://issues.apache.org/jira/browse/IMPALA-9286
             Project: IMPALA
          Issue Type: Task
            Reporter: Quanlong Huang


Local views (views in WITH-clause) are registered to each Analyzers' localViews_ (a map use their aliases as keys) and don't have fully qualified paths. This prevents us from resetting them in FromClause#reset(). Because the unresolved tableRefs should use fully qualified paths to make sure we get the same results in later resolution.

This may make the FromClause still dirty after reset() since it doesn't come back to the state before analyze(). We could introduce fully qualified paths for local views to fix this.

There's already an old TODO for this: [https://github.com/apache/impala/blob/1bf9212/fe/src/main/java/org/apache/impala/analysis/FromClause.java#L104-L107]
{code:java}
  public void reset() {
    for (int i = 0; i < size(); ++i) {
      TableRef origTblRef = get(i);
      if (origTblRef.isResolved() && !(origTblRef instanceof InlineViewRef)) {
        // Replace resolved table refs with unresolved ones.
        TableRef newTblRef = new TableRef(origTblRef);
        // Use the fully qualified raw path to preserve the original resolution.
        // Otherwise, non-fully qualified paths might incorrectly match a local view.
        // TODO for 2.3: This full qualification preserves analysis state which is
        // contrary to the intended semantics of reset(). We could address this issue by
        // changing the WITH-clause analysis to register local views that have
        // fully-qualified table refs, and then remove the full qualification here.
        newTblRef.rawPath_ = origTblRef.getResolvedPath().getFullyQualifiedRawPath();
        set(i, newTblRef);
      }
      get(i).reset();
    }
    this.analyzed_ = false;
  }
{code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)