-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-16004] [SQL] Correctly display "Last Access Time" of CatalogTable #13720
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
Changes from 3 commits
358ac0d
0fe835d
25510f5
26b9d79
8e7b271
90c3ff0
da8b77c
4c9e295
e93b72a
a72800c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -127,7 +127,7 @@ case class CatalogTable( | |
| sortColumnNames: Seq[String] = Seq.empty, | ||
| bucketColumnNames: Seq[String] = Seq.empty, | ||
| numBuckets: Int = -1, | ||
| owner: String = "", | ||
| owner: String = System.getProperty("user.name"), | ||
| createTime: Long = System.currentTimeMillis, | ||
| lastAccessTime: Long = -1, | ||
| properties: Map[String, String] = Map.empty, | ||
|
|
@@ -180,7 +180,8 @@ case class CatalogTable( | |
| Seq(s"Table: ${identifier.quotedString}", | ||
| if (owner.nonEmpty) s"Owner: $owner" else "", | ||
| s"Created: ${new Date(createTime).toString}", | ||
| s"Last Access: ${new Date(lastAccessTime).toString}", | ||
| "Last Access: " + | ||
| (if (lastAccessTime == -1) "UNKNOWN" else new Date(lastAccessTime).toString), | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't feel strongly about it, but seems like elsewhere an empty string is used for no values. This seems slightly preferable.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here is the code from Hive (it is using 0 as initial last access value):
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, but the rest of this code doesn't use that logic. It returns "" in code around this area.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I prefer empty string here, cc @yhuai @liancheng what do you think?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Empty string looks fine to me.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please follow this? |
||
| s"Type: ${tableType.name}", | ||
| if (schema.nonEmpty) s"Schema: ${schema.mkString("[", ", ", "]")}" else "", | ||
| if (partitionColumnNames.nonEmpty) s"Partition Columns: $partitionColumns" else "", | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -468,7 +468,8 @@ case class DescribeTableCommand(table: TableIdentifier, isExtended: Boolean, isF | |
| append(buffer, "Database:", table.database, "") | ||
| append(buffer, "Owner:", table.owner, "") | ||
| append(buffer, "Create Time:", new Date(table.createTime).toString, "") | ||
| append(buffer, "Last Access Time:", new Date(table.lastAccessTime).toString, "") | ||
| append(buffer, "Last Access Time:", | ||
| if (table.lastAccessTime == -1) "UNKNOWN" else new Date(table.lastAccessTime).toString, "") | ||
| append(buffer, "Location:", table.storage.locationUri.getOrElse(""), "") | ||
| append(buffer, "Table Type:", table.tableType.name, "") | ||
|
|
||
|
|
@@ -522,7 +523,7 @@ case class DescribeTableCommand(table: TableIdentifier, isExtended: Boolean, isF | |
|
|
||
| private def describeSchema(schema: Seq[CatalogColumn], buffer: ArrayBuffer[Row]): Unit = { | ||
| schema.foreach { column => | ||
| append(buffer, column.name, column.dataType.toLowerCase, column.comment.orNull) | ||
| append(buffer, column.name, column.dataType.toLowerCase, column.comment.getOrElse("")) | ||
|
||
| } | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this definitely the owner? it doesn't seem like it would generally be the user happening to run the application.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me check what HIVE does tomorrow and get it back to you.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
User name will be complicated. It is set from current SessionState authenticator. I do not believe we have reached that yet. I will revert this part.