Skip to content
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 @@ -99,7 +99,8 @@ case class CatalogTablePartition(
spec: CatalogTypes.TablePartitionSpec,
storage: CatalogStorageFormat,
parameters: Map[String, String] = Map.empty,
stats: Option[CatalogStatistics] = None) {
stats: Option[CatalogStatistics] = None,
schema: Option[StructType] = None) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The partition schema is stored in CatalogTable . I am not very clear what is the exception you got.

@dongjoon-hyun Could you help @liutang123 investigate the issue?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, @gatorsmile . I'll take a look during weekend.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some times, partition's schema is different from the table's.


def toLinkedHashMap: mutable.LinkedHashMap[String, String] = {
val map = new mutable.LinkedHashMap[String, String]()
Expand All @@ -109,6 +110,10 @@ case class CatalogTablePartition(
if (parameters.nonEmpty) {
map.put("Partition Parameters", s"{${parameters.map(p => p._1 + "=" + p._2).mkString(", ")}}")
}
if (schema.nonEmpty) {
map.put("Partition Cols",
s"{${schema.get.map(p => p.name + "=" + p.dataType).mkString(", ")}")
}
stats.foreach(s => map.put("Partition Statistics", s.simpleString))
map
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -991,6 +991,7 @@ private[hive] object HiveClientImpl {
p.storage.serde.foreach(serdeInfo.setSerializationLib)
serdeInfo.setParameters(p.storage.properties.asJava)
storageDesc.setSerdeInfo(serdeInfo)
storageDesc.setCols(p.schema.map(_.map(toHiveColumn).toList.asJava).orNull)
tpart.setDbName(ht.getDbName)
tpart.setTableName(ht.getTableName)
tpart.setValues(partValues.asJava)
Expand Down Expand Up @@ -1020,7 +1021,9 @@ private[hive] object HiveClientImpl {
properties = Option(apiPartition.getSd.getSerdeInfo.getParameters)
.map(_.asScala.toMap).orNull),
parameters = properties,
stats = readHiveStats(properties))
stats = readHiveStats(properties),
schema = Option(StructType(apiPartition.getSd.getCols.asScala.map(fromHiveColumn)))
)
}

/**
Expand Down