Skip to content

Conversation

@skambha
Copy link
Contributor

@skambha skambha commented Oct 26, 2016

What changes were proposed in this pull request?

Issue:
Querying on a global temp view throws Table or view not found exception.

Fix:
Update the lookupRelation in HiveSessionCatalog to check for global temp views similar to the SessionCatalog.lookupRelation.

Before fix:
Querying on a global temp view ( for. e.g.: select * from global_temp.v1) throws Table or view not found exception

After fix:
Query succeeds and returns the right result.

How was this patch tested?

  • Two unit tests are added to check for global temp view for the code path when hive support is enabled.
  • Regression unit tests were run successfully. ( build/sbt -Phive hive/test, build/sbt sql/test, build/sbt catalyst/test)

@gatorsmile
Copy link
Member

ok to test

@gatorsmile
Copy link
Member

@cloud-fan Could you take a look at this? The code changes look good to me. Thanks!

@viirya
Copy link
Member

viirya commented Oct 27, 2016

LGTM

test("query global temp view") {
val df = Seq(1).toDF("i1")
df.createGlobalTempView("tbl1")
checkAnswer(spark.sql("select * from global_temp.tbl1"), Row(1))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of hardcode global_temp here, we should read the conf: spark.sharedState.globalTempViewManager.database

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @cloud-fan. I have changed the test to get the global_temp db from the conf. spark.conf.get("spark.sql.globalTempDatabase”)

It looks like there are two ways to get it:

  • One is using the conf
  • Accessing the spark.sharedState.globalTempViewManager.database

In the test, I am now getting it from the conf. Please see if this is ok. Thanks.

@cloud-fan
Copy link
Contributor

ok to test

@cloud-fan
Copy link
Contributor

LGTM

@SparkQA
Copy link

SparkQA commented Oct 27, 2016

Test build #67621 has finished for PR 15649 at commit 95312dd.

  • This patch fails PySpark unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@gatorsmile
Copy link
Member

retest this please

@SparkQA
Copy link

SparkQA commented Oct 27, 2016

Test build #67627 has finished for PR 15649 at commit 95312dd.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@SparkQA
Copy link

SparkQA commented Oct 27, 2016

Test build #67657 has finished for PR 15649 at commit 387b28a.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@cloud-fan
Copy link
Contributor

thanks, merging to master!

@asfgit asfgit closed this in ab5f938 Oct 28, 2016
@skambha
Copy link
Contributor Author

skambha commented Oct 28, 2016

Thanks @cloud-fan, @gatorsmile, @viirya

robert3005 pushed a commit to palantir/spark that referenced this pull request Nov 1, 2016
…t is enabled

## What changes were proposed in this pull request?

Issue:
Querying on a global temp view throws Table or view not found exception.

Fix:
Update the lookupRelation in HiveSessionCatalog to check for global temp views similar to the SessionCatalog.lookupRelation.

Before fix:
Querying on a global temp view ( for. e.g.:  select * from global_temp.v1)  throws Table or view not found exception

After fix:
Query succeeds and returns the right result.

## How was this patch tested?
- Two unit tests are added to check for global temp view for the code path when hive support is enabled.
- Regression unit tests were run successfully. ( build/sbt -Phive hive/test, build/sbt sql/test, build/sbt catalyst/test)

Author: Sunitha Kambhampati <[email protected]>

Closes apache#15649 from skambha/lookuprelationChanges.
uzadude pushed a commit to uzadude/spark that referenced this pull request Jan 27, 2017
…t is enabled

## What changes were proposed in this pull request?

Issue:
Querying on a global temp view throws Table or view not found exception.

Fix:
Update the lookupRelation in HiveSessionCatalog to check for global temp views similar to the SessionCatalog.lookupRelation.

Before fix:
Querying on a global temp view ( for. e.g.:  select * from global_temp.v1)  throws Table or view not found exception

After fix:
Query succeeds and returns the right result.

## How was this patch tested?
- Two unit tests are added to check for global temp view for the code path when hive support is enabled.
- Regression unit tests were run successfully. ( build/sbt -Phive hive/test, build/sbt sql/test, build/sbt catalyst/test)

Author: Sunitha Kambhampati <[email protected]>

Closes apache#15649 from skambha/lookuprelationChanges.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants