Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BACKPORT-2.2] [SPARK-22488][SQL] Fix the view resolution issue in the SparkSession internal table() API #19723

Closed
wants to merge 1 commit into from

Commits on Nov 11, 2017

  1. [SPARK-22488][SQL] Fix the view resolution issue in the SparkSession …

    …internal table() API
    
    The current internal `table()` API of `SparkSession` bypasses the Analyzer and directly calls `sessionState.catalog.lookupRelation` API. This skips the view resolution logics in our Analyzer rule `ResolveRelations`. This internal API is widely used by various DDL commands, public and internal APIs.
    
    Users might get the strange error caused by view resolution when the default database is different.
    ```
    Table or view not found: t1; line 1 pos 14
    org.apache.spark.sql.AnalysisException: Table or view not found: t1; line 1 pos 14
    	at org.apache.spark.sql.catalyst.analysis.package$AnalysisErrorAt.failAnalysis(package.scala:42)
    ```
    
    This PR is to fix it by enforcing it to use `ResolveRelations` to resolve the table.
    
    Added a test case and modified the existing test cases
    
    Author: gatorsmile <gatorsmile@gmail.com>
    
    Closes apache#19713 from gatorsmile/viewResolution.
    gatorsmile committed Nov 11, 2017
    Configuration menu
    Copy the full SHA
    e8f6dbb View commit details
    Browse the repository at this point in the history