Skip to content

Commit

Permalink
[KYUUBI#1458] Delta lake table columns won't show up in DBeaver.
Browse files Browse the repository at this point in the history
  • Loading branch information
mmuru-w committed Nov 30, 2021
1 parent 9d8476a commit 28a4a12
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down Expand Up @@ -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) }
}
}
Expand Down

0 comments on commit 28a4a12

Please sign in to comment.