diff --git a/sql/catalyst/src/main/java/org/apache/spark/sql/connector/catalog/TableViewCatalog.java b/sql/catalyst/src/main/java/org/apache/spark/sql/connector/catalog/TableViewCatalog.java index c3298831ef3e..45ec41d680d8 100644 --- a/sql/catalyst/src/main/java/org/apache/spark/sql/connector/catalog/TableViewCatalog.java +++ b/sql/catalyst/src/main/java/org/apache/spark/sql/connector/catalog/TableViewCatalog.java @@ -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. - *
  • {@link #listRelationSummaries(String[])} -- a unified listing of tables and views with the - * kind preserved on each {@link TableSummary}. Default impl performs both + *
  • {@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.
  • * @@ -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); diff --git a/sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/ShowTablesExec.scala b/sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/ShowTablesExec.scala index 38140d62cb15..8680785e0815 100644 --- a/sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/ShowTablesExec.scala +++ b/sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/ShowTablesExec.scala @@ -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. @@ -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 => diff --git a/sql/core/src/test/scala/org/apache/spark/sql/connector/DataSourceV2MetadataViewSuite.scala b/sql/core/src/test/scala/org/apache/spark/sql/connector/DataSourceV2MetadataViewSuite.scala index cc22d01fe079..163c0957e0d0 100644 --- a/sql/core/src/test/scala/org/apache/spark/sql/connector/DataSourceV2MetadataViewSuite.scala +++ b/sql/core/src/test/scala/org/apache/spark/sql/connector/DataSourceV2MetadataViewSuite.scala @@ -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")