Skip to content

Commit a05383c

Browse files
committed
updated the error msg
1 parent 473b27d commit a05383c

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

  • sql/core/src/main/scala/org/apache/spark/sql/execution/command

sql/core/src/main/scala/org/apache/spark/sql/execution/command/tables.scala

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,13 @@ case class DescribeTableCommand(table: TableIdentifier, isExtended: Boolean, isF
428428
// Shows data columns and partitioned columns (if any)
429429
private def describe(table: CatalogTable, buffer: ArrayBuffer[Row]): Unit = {
430430
if (DDLUtils.isDatasourceTable(table)) {
431-
DDLUtils.getSchemaFromTableProperties(table).foreach(describeSchema(_, buffer))
431+
val schema = DDLUtils.getSchemaFromTableProperties(table)
432+
433+
if (schema.isEmpty) {
434+
append(buffer, "# Schema of this table in catalog is corrupted", "", "")
435+
} else {
436+
schema.foreach(describeSchema(_, buffer))
437+
}
432438

433439
val partCols = DDLUtils.getPartitionColumnsFromTableProperties(table)
434440
if (partCols.nonEmpty) {

0 commit comments

Comments
 (0)