1
0

[HUDI-4079] Supports showing table comment for hudi with spark3 (#5546)

This commit is contained in:
Jin Xing
2022-05-11 22:28:58 +08:00
committed by GitHub
parent 4a8589f222
commit 7f0c1f3ddf
2 changed files with 38 additions and 13 deletions

View File

@@ -89,19 +89,21 @@ class HoodieCatalog extends DelegatingCatalogExtension
}
override def loadTable(ident: Identifier): Table = {
try {
super.loadTable(ident) match {
case v1: V1Table if sparkAdapter.isHoodieTable(v1.catalogTable) =>
HoodieInternalV2Table(
spark,
v1.catalogTable.location.toString,
catalogTable = Some(v1.catalogTable),
tableIdentifier = Some(ident.toString))
case o => o
}
} catch {
case e: Exception =>
throw e
super.loadTable(ident) match {
case V1Table(catalogTable0) if sparkAdapter.isHoodieTable(catalogTable0) =>
val catalogTable = catalogTable0.comment match {
case Some(v) =>
val newProps = catalogTable0.properties + (TableCatalog.PROP_COMMENT -> v)
catalogTable0.copy(properties = newProps)
case _ =>
catalogTable0
}
HoodieInternalV2Table(
spark = spark,
path = catalogTable.location.toString,
catalogTable = Some(catalogTable),
tableIdentifier = Some(ident.toString))
case o => o
}
}