Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[KYUUBI #4218] Prefer to use TableCatalog to load tables from session catalog #4219

Closed
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 @@ -139,13 +139,7 @@ class CatalogShim_v2_4 extends SparkCatalogShim {
databases.flatMap { db =>
val identifiers = catalog.listTables(db, tablePattern, includeLocalTempViews = true)
catalog.getTablesByName(identifiers).flatMap { t =>
val tableSchema =
if (t.provider.getOrElse("").equalsIgnoreCase("delta")) {
spark.table(t.identifier.table).schema
} else {
t.schema
}
tableSchema.zipWithIndex.filter(f => columnPattern.matcher(f._1.name).matches())
t.schema.zipWithIndex.filter(f => columnPattern.matcher(f._1.name).matches())
.map { case (f, i) => toColumnResult(catalogName, t.database, t.identifier.table, f, i) }
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,14 +188,6 @@ class CatalogShim_v3_0 extends CatalogShim_v2_4 {
val catalog = getCatalog(spark, catalogName)

catalog match {
case builtin if builtin.name() == SESSION_CATALOG =>
super.getColumnsByCatalog(
spark,
SESSION_CATALOG,
schemaPattern,
tablePattern,
columnPattern)

case tc: TableCatalog =>
val namespaces = listNamespacesWithPattern(catalog, schemaPattern)
val tp = tablePattern.r.pattern
Expand All @@ -210,6 +202,14 @@ class CatalogShim_v3_0 extends CatalogShim_v2_4 {
table.schema.zipWithIndex.filter(f => columnPattern.matcher(f._1.name).matches())
.map { case (f, i) => toColumnResult(tc.name(), namespace, tableName, f, i) }
}

case builtin if builtin.name() == SESSION_CATALOG =>
super.getColumnsByCatalog(
spark,
SESSION_CATALOG,
schemaPattern,
tablePattern,
columnPattern)
}
}
}