Skip to content

Conversation

@gatorsmile
Copy link
Member

What changes were proposed in this pull request?

spark.catalog.listTables and spark.catalog.getTable does not work if we are unable to retrieve table metadata due to any reason (e.g., table serde class is not accessible or the table type is not accepted by Spark SQL). After this PR, the APIs still return the corresponding Table without the description and tableType)

How was this patch tested?

Added a test case

@SparkQA
Copy link

SparkQA commented Apr 23, 2017

Test build #76072 has finished for PR 17730 at commit 1a5e24d.

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

@gatorsmile
Copy link
Member Author

cc @cloud-fan @sameeragarwal

if (tableExists(dbName, tableName)) {
makeTable(TableIdentifier(tableName, Option(dbName)))
} else {
throw new AnalysisException(s"Table or view '$tableName' not found in database '$dbName'")
Copy link
Contributor

Choose a reason for hiding this comment

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

The doc says This throws an AnalysisException when no Table can be found., I think we should not change this behavior

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes. That is why an AnalysisException is issued here. makeTable eats the expected exception.

@cloud-fan
Copy link
Contributor

LGTM, merging to master/2.2!

@asfgit asfgit closed this in 776a2c0 Apr 24, 2017
asfgit pushed a commit that referenced this pull request Apr 24, 2017
…d to fetch table metadata

### What changes were proposed in this pull request?

`spark.catalog.listTables` and `spark.catalog.getTable` does not work if we are unable to retrieve table metadata due to any reason (e.g., table serde class is not accessible or the table type is not accepted by Spark SQL). After this PR, the APIs still return the corresponding Table without the description and tableType)

### How was this patch tested?
Added a test case

Author: Xiao Li <[email protected]>

Closes #17730 from gatorsmile/listTables.

(cherry picked from commit 776a2c0)
Signed-off-by: Wenchen Fan <[email protected]>
@sameeragarwal
Copy link
Member

should we backport this to earlier releases too?

@gatorsmile
Copy link
Member Author

Sure, will do it to 2.1

asfgit pushed a commit that referenced this pull request Apr 26, 2017
…ble when failed to fetch table metadata

### What changes were proposed in this pull request?

This PR is to backport #17730 to Spark 2.1
--- --
`spark.catalog.listTables` and `spark.catalog.getTable` does not work if we are unable to retrieve table metadata due to any reason (e.g., table serde class is not accessible or the table type is not accepted by Spark SQL). After this PR, the APIs still return the corresponding Table without the description and tableType)

### How was this patch tested?
Added a test case

Author: Xiao Li <[email protected]>

Closes #17760 from gatorsmile/backport-17730.
peter-toth pushed a commit to peter-toth/spark that referenced this pull request Oct 6, 2018
…d to fetch table metadata

### What changes were proposed in this pull request?

`spark.catalog.listTables` and `spark.catalog.getTable` does not work if we are unable to retrieve table metadata due to any reason (e.g., table serde class is not accessible or the table type is not accepted by Spark SQL). After this PR, the APIs still return the corresponding Table without the description and tableType)

### How was this patch tested?
Added a test case

Author: Xiao Li <[email protected]>

Closes apache#17730 from gatorsmile/listTables.
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.

4 participants