Skip to content

Commit dc11f3a

Browse files
committed
[SPARK-28930][SQL] Last Access Time value shall display 'UNKNOWN' as currently system cannot evaluate the last access time, and 'null' values will be shown in its capital form 'NULL' for SQL client to make the
display format similar to spark-shell. What changes were proposed in this pull request? If there is no comment for spark scala shell shows "null" in small letters but all other places Hive beeline/Spark beeline/Spark SQL it is showing in CAPITAL "NULL". In this patch shown in its capital form 'NULL' for SQL client to make the display format similar to Hive beeline/Spark beeline/Spark SQL. Also corrected the Last Access time, the value shall display 'UNKNOWN' as currently system wont support the last access time evaluation. Issue 2 mentioned in JIRA Spark SQL "desc formatted tablename" is not showing the header # col_name,data_type,comment , seems to be the header has been removed knowingly as part of SPARK-20954. Does this PR introduce any user-facing change? No How was this patch tested? Locally and corrected a ut.
1 parent 2568d50 commit dc11f3a

File tree

3 files changed

+6
-7
lines changed

3 files changed

+6
-7
lines changed

sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/trees/TreeNodeSuite.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,7 @@ class TreeNodeSuite extends SparkFunSuite with SQLHelper {
513513
"partitionColumnNames" -> List.empty[String],
514514
"owner" -> "",
515515
"createTime" -> 0,
516-
"lastAccessTime" -> -1,
516+
"lastAccessTime" -> 0,
517517
"createVersion" -> "2.x",
518518
"tracksPartitionsInCatalog" -> false,
519519
"properties" -> JNull,

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -510,8 +510,7 @@ abstract class DescribeCommandBase extends RunnableCommand {
510510
append(buffer, s"# ${output.head.name}", output(1).name, output(2).name)
511511
}
512512
schema.foreach { column =>
513-
append(buffer, column.name, column.dataType.simpleString,
514-
column.getComment().getOrElse("NULL"))
513+
append(buffer, column.name, column.dataType.simpleString, column.getComment().orNull)
515514
}
516515
}
517516

sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveDDLSuite.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1042,11 +1042,11 @@ class HiveDDLSuite
10421042

10431043
assert(sql("DESC tbl").collect().containsSlice(
10441044
Seq(
1045-
Row("a", "int", "NULL"),
1046-
Row("b", "int", "NULL"),
1045+
Row("a", "int", null),
1046+
Row("b", "int", null),
10471047
Row("# Partition Information", "", ""),
10481048
Row("# col_name", "data_type", "comment"),
1049-
Row("b", "int", "NULL")
1049+
Row("b", "int", null)
10501050
)
10511051
))
10521052
}
@@ -1617,7 +1617,7 @@ class HiveDDLSuite
16171617

16181618
val desc = sql("DESC FORMATTED t1").collect().toSeq
16191619

1620-
assert(desc.contains(Row("id", "bigint", "NULL")))
1620+
assert(desc.contains(Row("id", "bigint", null)))
16211621
}
16221622
}
16231623
}

0 commit comments

Comments
 (0)