-
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
Conversation
|
Test build #60668 has finished for PR 13720 at commit
|
|
Test build #60677 has finished for PR 13720 at commit
|
|
@srowen please review. thanks! |
| s"Created: ${new Date(createTime).toString}", | ||
| s"Last Access: ${new Date(lastAccessTime).toString}", | ||
| "Last Access: " + | ||
| (if (lastAccessTime == -1) "UNKNOWN" else new Date(lastAccessTime).toString), |
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.
I don't feel strongly about it, but seems like elsewhere an empty string is used for no values. This seems slightly preferable.
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.
Here is the code from Hive (it is using 0 as initial last access value):
File: MetaDataFormatUtils.java
private static String formatDate(long timeInSeconds) {
if (timeInSeconds != 0) {
Date date = new Date(timeInSeconds * 1000);
return date.toString();
}
return "UNKNOWN";
}
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.
Yes, but the rest of this code doesn't use that logic. It returns "" in code around this area.
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.
I prefer empty string here, cc @yhuai @liancheng what do you think?
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.
Empty string looks fine to me.
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.
Please follow this?
|
Test build #60968 has finished for PR 13720 at commit
|
|
@cloud-fan Is this one worth to be fixed? |
| 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.
this is a behaviour changing. The result is not only used to display, but also used as a table to be queried later. I'm not sure it worth. cc @yhuai
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.
Yea. If it is null, let's keep it as null. Changing a null to an empty string actually destroys the information.
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.
Agree, a column without any comment (null) is different from a column with a comment that is an empty string.
|
For the test, currently we only have one |
|
ok, i will work on it based on comments. Thanks. |
|
Test build #61196 has finished for PR 13720 at commit
|
|
Test build #61311 has finished for PR 13720 at commit
|
|
@cloud-fan please review again, thanks. |
|
@bomeng Cloud you resolve the conflicts? |
| } | ||
| } | ||
|
|
||
| test("Describe Table") { |
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.
This test case does not verify the issue you fixed, I think
|
ping @bomeng |
# What changes were proposed in this pull request? This PR proposes to close stale PRs, mostly the same instances with apache#18017 Closes apache#11459 Closes apache#13833 Closes apache#13720 Closes apache#12506 Closes apache#12456 Closes apache#12252 Closes apache#17689 Closes apache#17791 Closes apache#18163 Closes apache#17640 Closes apache#17926 Closes apache#18163 Closes apache#12506 Closes apache#18044 Closes apache#14036 Closes apache#15831 Closes apache#14461 Closes apache#17638 Closes apache#18222 Added: Closes apache#18045 Closes apache#18061 Closes apache#18010 Closes apache#18041 Closes apache#18124 Closes apache#18130 Closes apache#12217 Added: Closes apache#16291 Closes apache#17480 Closes apache#14995 Added: Closes apache#12835 Closes apache#17141 ## How was this patch tested? N/A Author: hyukjinkwon <[email protected]> Closes apache#18223 from HyukjinKwon/close-stale-prs.
What changes were proposed in this pull request?
A few issues found when running "describe extended | formatted [tableName]" command:
Comments fields display "null" instead of empty string when commend is None;How was this patch tested?
Currently, I have manually tested them - it is very straight-forward to test, but hard to write test cases for them.