-
Notifications
You must be signed in to change notification settings - Fork 28.9k
[SPARK-39506][SQL] Make CacheTable, isCached, UncacheTable, setCurrentCatalog, currentCatalog, listCatalogs 3l namespace compatible #36904
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
|
R: @cloud-fan |
|
Can one of the admins verify this patch? |
sql/core/src/main/scala/org/apache/spark/sql/catalog/Catalog.scala
Outdated
Show resolved
Hide resolved
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.
if it's simply a string, shall we just let listCatalogs return Dataset[String]?
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.
We might design the class like this
case class CatalogMetadata(
name: String,
description: String,
owner: Option[String] = None,
catalogType: Option[CatalogType] = None,
createdAt: Option[Long] = None,
createdBy: Option[String] = None,
updatedAt: Option[Long] = None,
updatedBy: Option[String] = None
)
However, I am not sure if there are extra information we can fetch for a catalog. Do you know if we have such rich metadata for a catalog in Spark?
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.
If Spark only knows the catalog name, then probably Dataset[String] would be fine.
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.
ok let's keep it then, and add a description field so that it doesn't look so weird.
About the naming, how about just Catalog? to match Database and Table in this file.
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 for keeping the class and additionally adding a description field.
Regrading renaming to Catalog, it will have a naming conflict with
| abstract class Catalog { |
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.
ah I see!
sql/core/src/main/scala/org/apache/spark/sql/internal/CatalogImpl.scala
Outdated
Show resolved
Hide resolved
…log, currentCatalog, listCatalogs 3l namespace compatible.
|
Also I am seeing this Any idea how to make the new API pass such API compatibility check? |
|
Adding @zhengruifeng FYI |
sql/core/src/test/scala/org/apache/spark/sql/internal/CatalogSuite.scala
Outdated
Show resolved
Hide resolved
sql/core/src/main/scala/org/apache/spark/sql/catalog/Catalog.scala
Outdated
Show resolved
Hide resolved
sql/core/src/main/scala/org/apache/spark/sql/catalog/Catalog.scala
Outdated
Show resolved
Hide resolved
sql/core/src/main/scala/org/apache/spark/sql/catalog/Catalog.scala
Outdated
Show resolved
Hide resolved
| assert(spark.catalog.currentCatalog().equals("testcat")) | ||
| spark.catalog.setCurrentCatalog("spark_catalog") | ||
| assert(spark.catalog.currentCatalog().equals("spark_catalog")) | ||
| assert(spark.catalog.listCatalogs().collect().map(c => c.name).toSet == Set("testcat")) |
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.
not related to this PR, but we should figure out why spark_catalog is missed here.
|
The last commit only updates a comment, I'm merging it to master, thanks! |
|
@cloud-fan thank you! |
What changes were proposed in this pull request?
Why are the changes needed?
This is a part of effort for 3l namespace work.
Does this PR introduce any user-facing change?
Yes. There are 3 new API added in this PR (setCurrentCatalog, currentCatalog, listCatalogs) and unCacheTable API will support 3l namespace.
How was this patch tested?
UT