-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-39828][SQL] Catalog.listTables should respect currentCatalog
#37241
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -95,11 +95,11 @@ class CatalogImpl(sparkSession: SparkSession) extends Catalog { | |
| } | ||
|
|
||
| /** | ||
| * Returns a list of tables in the current database. | ||
| * Returns a list of tables in the current catalog and current database. | ||
| * This includes all temporary tables. | ||
| */ | ||
| override def listTables(): Dataset[Table] = { | ||
| listTables(currentDatabase) | ||
| listTables(currentCatalog() ++ "." ++ currentDatabase) | ||
| } | ||
|
|
||
| /** | ||
|
|
@@ -120,7 +120,13 @@ class CatalogImpl(sparkSession: SparkSession) extends Catalog { | |
| val plan = ShowTables(UnresolvedNamespace(ident), None) | ||
| val ret = sparkSession.sessionState.executePlan(plan).toRdd.collect() | ||
| val tables = ret | ||
| .map(row => ident ++ Seq(row.getString(1))) | ||
| .map(row => | ||
| // for views, their namespace are empty | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it's only true for temp views?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I tried to parse that Do you know what is the right way to parse a serialized boolean? Should I use a RowDeserializer somehow?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For example, for a temp view named
Also I actually don't know why there are five values in the row.... |
||
| if (row.getString(0).isEmpty) { | ||
| Seq(row.getString(1)) | ||
| } else { | ||
| ident ++ Seq(row.getString(1)) | ||
| }) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For my understanding, is this a regression due to one of the recent commits like SPARK-39236?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. SPARK-39236 updated This is more like a side effect of SPARK-39506. Because in SPARK-39506 we support
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe it is hard to define whether this is a regression (I would rather say it is a side effect that given we introduced a way to control current catalog). I think at least it still maintains backwards compatibility. For old users who do not need set current catalog, it will still be the one that they would target to ( And then for new users, their set current catalog will be respected.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for the detail. Yes, it's hard to say always during extending the existing semantics. New features are always nice to have, but what I hope is to keep the original features safe and independent as much as possible . As long as the old code works, we are good. Thank you again for all your efforts, @amaliujia .
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Avoiding deprecations is also the best way until we are sure that the new features are manure enough.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. agreed on that there should be a period of time to have new features mature enough with good adoptions before talking about deprecations. |
||
| .map(makeTable) | ||
| CatalogImpl.makeDataset(tables, sparkSession) | ||
| } | ||
|
|
||
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.
There is no
listViewsinTableCataloginterface so I think it should be inlistTables. IIUC existing v1 session catalog does this already (list views when callinglistTables)