From 28a4a12d4be0ed3c1dda61176f260061d6489b36 Mon Sep 17 00:00:00 2001 From: Muru Muthusamy Date: Tue, 30 Nov 2021 14:53:53 -0800 Subject: [PATCH] [KYUUBI#1458] Delta lake table columns won't show up in DBeaver. --- .../kyuubi/engine/spark/shim/CatalogShim_v2_4.scala | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/externals/kyuubi-spark-sql-engine/src/main/scala/org/apache/kyuubi/engine/spark/shim/CatalogShim_v2_4.scala b/externals/kyuubi-spark-sql-engine/src/main/scala/org/apache/kyuubi/engine/spark/shim/CatalogShim_v2_4.scala index 4f703394c75..2f2988fcc7c 100644 --- a/externals/kyuubi-spark-sql-engine/src/main/scala/org/apache/kyuubi/engine/spark/shim/CatalogShim_v2_4.scala +++ b/externals/kyuubi-spark-sql-engine/src/main/scala/org/apache/kyuubi/engine/spark/shim/CatalogShim_v2_4.scala @@ -21,6 +21,7 @@ import java.util.regex.Pattern import org.apache.spark.sql.{Row, SparkSession} import org.apache.spark.sql.catalyst.TableIdentifier +import org.apache.spark.sql.types.StructType class CatalogShim_v2_4 extends SparkCatalogShim { @@ -125,7 +126,12 @@ class CatalogShim_v2_4 extends SparkCatalogShim { databases.flatMap { db => val identifiers = catalog.listTables(db, tablePattern, includeLocalTempViews = true) catalog.getTablesByName(identifiers).flatMap { t => - t.schema.zipWithIndex.filter(f => columnPattern.matcher(f._1.name).matches()) + var tableSchema: StructType = null; + tableSchema = t.schema + if (t.provider.getOrElse("") == "delta") { + tableSchema = spark.table(t.identifier.table).schema + } + tableSchema.zipWithIndex.filter(f => columnPattern.matcher(f._1.name).matches()) .map { case (f, i) => toColumnResult(catalogName, t.database, t.identifier.table, f, i) } } }