Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@
* a regular {@link Table} for a table, or a {@link MetadataTable} wrapping a
* {@link ViewInfo} for a view. Saves the {@code loadTable} -> {@code loadView} fallback
* on a cold cache.</li>
* <li>{@link #listRelationSummaries(String[])} -- a unified listing of tables and views with the
* kind preserved on each {@link TableSummary}. Default impl performs both
* <li>{@link #listTableAndViewSummaries(String[])} -- a unified listing of tables and views
* with the kind preserved on each {@link TableSummary}. Default impl performs both
* {@link TableCatalog#listTableSummaries} and {@link ViewCatalog#listViews}; override to
* fetch in one round trip.</li>
* </ul>
Expand Down Expand Up @@ -149,7 +149,7 @@ public interface TableViewCatalog extends TableCatalog, ViewCatalog {
* @throws NoSuchTableException if a table listed by the underlying enumeration disappears
* before its summary can be assembled (default impl only)
*/
default TableSummary[] listRelationSummaries(String[] namespace)
default TableSummary[] listTableAndViewSummaries(String[] namespace)
throws NoSuchNamespaceException, NoSuchTableException {
TableSummary[] tableSummaries = listTableSummaries(namespace);
Identifier[] viewIdentifiers = listViews(namespace);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import org.apache.spark.sql.execution.LeafExecNode
* Physical plan node for showing tables.
*
* For a [[TableViewCatalog]] (one that exposes both tables and views in a shared identifier
* namespace), this routes through [[TableViewCatalog#listRelationSummaries]] so that views are
* namespace), this routes through [[TableViewCatalog#listTableAndViewSummaries]] so that views are
* included in the listing -- matching the v1 `SHOW TABLES` semantics where views appear
* alongside tables. Pure [[TableCatalog]] catalogs continue to use `listTables` and return
* tables only.
Expand All @@ -44,7 +44,8 @@ case class ShowTablesExec(
val rows = new ArrayBuffer[InternalRow]()

val identifiers: Array[Identifier] = catalog match {
case mc: TableViewCatalog => mc.listRelationSummaries(namespace.toArray).map(_.identifier())
case mc: TableViewCatalog =>
mc.listTableAndViewSummaries(namespace.toArray).map(_.identifier())
case _ => catalog.listTables(namespace.toArray)
}
identifiers.foreach { ident =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ class DataSourceV2MetadataViewSuite extends QueryTest with SharedSparkSession {

test("SHOW TABLES on a TableViewCatalog returns both tables and views (v1-parity)") {
// For a `TableViewCatalog` (a catalog exposing both tables and views in a shared
// identifier namespace), SHOW TABLES routes through `listRelationSummaries` so views
// identifier namespace), SHOW TABLES routes through `listTableAndViewSummaries` so views
// appear alongside tables -- matching the v1 SHOW TABLES output. Pure `TableCatalog`
// catalogs (no view mixin) continue to use `listTables` and return tables only.
seedV2View("v_in_show_tables")
Expand Down