-
Notifications
You must be signed in to change notification settings - Fork 28.9k
[SPARK-26946][SQL][FOLLOWUP] Require lookup function #24689
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
Conversation
Treat it as catalog not found.
|
Test build #105734 has finished for PR 24689 at commit
|
|
Retest this please. |
|
Test build #105799 has finished for PR 24689 at commit
|
59363b2 to
b62182f
Compare
|
Removed commit |
|
Test build #105806 has finished for PR 24689 at commit
|
sql/catalyst/src/main/scala/org/apache/spark/sql/catalog/v2/LookupCatalog.scala
Outdated
Show resolved
Hide resolved
HyukjinKwon
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey, @jzhuge, can we clarify what handling None means in PR description?
|
Test build #105817 has finished for PR 24689 at commit
|
sql/catalyst/src/main/scala/org/apache/spark/sql/catalog/v2/LookupCatalog.scala
Outdated
Show resolved
Hide resolved
sql/catalyst/src/main/scala/org/apache/spark/sql/catalog/v2/LookupCatalog.scala
Outdated
Show resolved
Hide resolved
|
@jzhuge, these changes look okay, but I think the right path is to always require a lookup function and get rid of the option. There is never a time when these should be used without a catalog lookup function and not requiring that one is supplied leads to avoidable errors. I've been testing a |
|
Well said @rdblue. I will proceed with the requirement of a lookup function. Since the interface is not widely used (yet), not too many places need update. |
|
Test build #105857 has finished for PR 24689 at commit
|
|
Not sure what the following failure is in test build #105857: |
|
Test build #105877 has finished for PR 24689 at commit
|
| * [[UnresolvedRelation]]s into fully typed objects using information in a [[SessionCatalog]]. | ||
| */ | ||
| class Analyzer( | ||
| abstract class Analyzer( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not continue to pass a lookup function in some paths and default the analyzer to use one that throws CatalogNotFoundException? That would avoid a lot of these changes.
class Analyzer(..., catalogLookup: String => CatalogPlugin) {
def this(...) = {
this(..., _ => throw new CatalogNotFoundException("Analyzer does not support multiple catalogs"))
}
}
override def lookupCatalog(name: String): CatalogPlugin = catalogLookup(name)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reverted commit Make Analyzer abstract and add TestAnalyzer to minimize changes to test classes.
If you feel strongly, I can add the 4th parameter override val lookupCatalog: String => CatalogPlugin to Analyzer constructor. Although users can override in the following manner:
new Analyzer() {
override def lookupCatalog(name: String): CatalogPlugin = ???
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good to me.
This reverts commit 0f73998.
|
Test build #105884 has finished for PR 24689 at commit
|
|
Looks good to me. One minor comment: it doesn't look like Analyzer implementations created in BaseSessionStateBuilder actually override the lookup method to call the session's catalog lookup. I would probably include that in this PR, but we can also add it in later PRs when it is used. +1, I think this is ready to merge either way. @cloud-fan, @dongjoon-hyun, @HyukjinKwon, could you take a look at this DSv2 PR? Thanks! |
|
LGTM, merging to master! |
|
Thanks @HyukjinKwon @rdblue @cloud-fan ! |
## What changes were proposed in this pull request?
Require the lookup function with interface LookupCatalog. Rationale is in the review comments below.
Make `Analyzer` abstract. BaseSessionStateBuilder and HiveSessionStateBuilder implements lookupCatalog with a call to SparkSession.catalog().
Existing test cases and those that don't need catalog lookup will use a newly added `TestAnalyzer` with a default lookup function that throws` CatalogNotFoundException("No catalog lookup function")`.
Rewrote the unit test for LookupCatalog to demonstrate the interface can be used anywhere, not just Analyzer.
Removed Analyzer parameter `lookupCatalog` because we can override in the following manner:
```
new Analyzer() {
override def lookupCatalog(name: String): CatalogPlugin = ???
}
```
## How was this patch tested?
Existing unit tests.
Closes apache#24689 from jzhuge/SPARK-26946-follow.
Authored-by: John Zhuge <[email protected]>
Signed-off-by: Wenchen Fan <[email protected]>
What changes were proposed in this pull request?
Require the lookup function with interface LookupCatalog. Rationale is in the review comments below.
Make
Analyzerabstract. BaseSessionStateBuilder and HiveSessionStateBuilder implements lookupCatalog with a call to SparkSession.catalog().Existing test cases and those that don't need catalog lookup will use a newly added
TestAnalyzerwith a default lookup function that throwsCatalogNotFoundException("No catalog lookup function").Rewrote the unit test for LookupCatalog to demonstrate the interface can be used anywhere, not just Analyzer.
Removed Analyzer parameter
lookupCatalogbecause we can override in the following manner:How was this patch tested?
Existing unit tests.