diff --git a/docs/configuration/settings.md b/docs/configuration/settings.md index b203b0bdacb..a6efe608574 100644 --- a/docs/configuration/settings.md +++ b/docs/configuration/settings.md @@ -392,7 +392,7 @@ You can configure the Kyuubi properties in `$KYUUBI_HOME/conf/kyuubi-defaults.co | Key | Default | Meaning | Type | Since | |--------------------------------------------------|---------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------|-------| -| kyuubi.operation.getTables.ignoreTableProperties | false | Speed up the `GetTables` operation by returning table identities only. | boolean | 1.8.0 | +| kyuubi.operation.getTables.ignoreTableProperties | false | Speed up the `GetTables` operation by ignoring `tableTypes` query criteria, and returning table identities only. | boolean | 1.8.0 | | kyuubi.operation.idle.timeout | PT3H | Operation will be closed when it's not accessed for this duration of time | duration | 1.0.0 | | kyuubi.operation.interrupt.on.cancel | true | When true, all running tasks will be interrupted if one cancels a query. When false, all running tasks will remain until finished. | boolean | 1.2.0 | | kyuubi.operation.language | SQL | Choose a programing language for the following inputs | string | 1.5.0 | diff --git a/externals/kyuubi-spark-sql-engine/src/main/scala/org/apache/kyuubi/engine/spark/util/SparkCatalogUtils.scala b/externals/kyuubi-spark-sql-engine/src/main/scala/org/apache/kyuubi/engine/spark/util/SparkCatalogUtils.scala index 18a14494e85..b55319830b5 100644 --- a/externals/kyuubi-spark-sql-engine/src/main/scala/org/apache/kyuubi/engine/spark/util/SparkCatalogUtils.scala +++ b/externals/kyuubi-spark-sql-engine/src/main/scala/org/apache/kyuubi/engine/spark/util/SparkCatalogUtils.scala @@ -163,8 +163,8 @@ object SparkCatalogUtils extends Logging { val namespaces = listNamespacesWithPattern(catalog, schemaPattern) catalog match { case builtin if builtin.name() == SESSION_CATALOG => - val catalog = spark.sessionState.catalog - val databases = catalog.listDatabases(schemaPattern) + val sessionCatalog = spark.sessionState.catalog + val databases = sessionCatalog.listDatabases(schemaPattern) def isMatchedTableType(tableTypes: Set[String], tableType: String): Boolean = { val typ = if (tableType.equalsIgnoreCase(VIEW)) VIEW else TABLE @@ -172,22 +172,39 @@ object SparkCatalogUtils extends Logging { } databases.flatMap { db => - val identifiers = catalog.listTables(db, tablePattern, includeLocalTempViews = false) - catalog.getTablesByName(identifiers) - .filter(t => isMatchedTableType(tableTypes, t.tableType.name)).map { t => - val typ = if (t.tableType.name == VIEW) VIEW else TABLE + val identifiers = + sessionCatalog.listTables(db, tablePattern, includeLocalTempViews = false) + if (ignoreTableProperties) { + identifiers.map { ti: TableIdentifier => Row( catalogName, - t.database, - t.identifier.table, - typ, - t.comment.getOrElse(""), + ti.database.getOrElse("default"), + ti.table, + TABLE, // ignore tableTypes criteria and simply treat all table type as TABLE + "", null, null, null, null, null) } + } else { + sessionCatalog.getTablesByName(identifiers) + .filter(t => isMatchedTableType(tableTypes, t.tableType.name)).map { t => + val typ = if (t.tableType.name == VIEW) VIEW else TABLE + Row( + catalogName, + t.database, + t.identifier.table, + typ, + t.comment.getOrElse(""), + null, + null, + null, + null, + null) + } + } } case tc: TableCatalog => val tp = tablePattern.r.pattern diff --git a/kyuubi-common/src/main/scala/org/apache/kyuubi/config/KyuubiConf.scala b/kyuubi-common/src/main/scala/org/apache/kyuubi/config/KyuubiConf.scala index 3eedfdded91..d68bc2646e2 100644 --- a/kyuubi-common/src/main/scala/org/apache/kyuubi/config/KyuubiConf.scala +++ b/kyuubi-common/src/main/scala/org/apache/kyuubi/config/KyuubiConf.scala @@ -3433,7 +3433,8 @@ object KyuubiConf { val OPERATION_GET_TABLES_IGNORE_TABLE_PROPERTIES: ConfigEntry[Boolean] = buildConf("kyuubi.operation.getTables.ignoreTableProperties") - .doc("Speed up the `GetTables` operation by returning table identities only.") + .doc("Speed up the `GetTables` operation by ignoring `tableTypes` query criteria, " + + "and returning table identities only.") .version("1.8.0") .booleanConf .createWithDefault(false)