Skip to content

[SPARK-16004] [SQL] Correctly display "Last Access Time" of CatalogTable - #13720

Closed
bomeng wants to merge 10 commits into
apache:masterfrom
bomeng:SPARK-16004
Closed

[SPARK-16004] [SQL] Correctly display "Last Access Time" of CatalogTable#13720
bomeng wants to merge 10 commits into
apache:masterfrom
bomeng:SPARK-16004

Conversation

@bomeng

@bomengbomeng commented Jun 16, 2016

Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

A few issues found when running "describe extended | formatted [tableName]" command:

  1. After creation of a table, the last access time is incorrectly displayed something like "Last Access Time: |Wed Dec 31 15:59:59 PST 1969", I think we should display as "UNKNOWN" as Hive does; the reason is the lastAccessTime was set to -1 and it was converted to Date.
  2. 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.

@bomengbomeng changed the title [SPAKR-16004] [SQL] improve the disply of CatalogTable information[SPAKR-16004] [SQL] improve the display of CatalogTable informationJun 16, 2016
@bomengbomeng changed the title [SPAKR-16004] [SQL] improve the display of CatalogTable information[SPARK-16004] [SQL] improve the display of CatalogTable informationJun 16, 2016
@SparkQA

Copy link
Copy Markdown

Test build #60668 has finished for PR 13720 at commit 358ac0d.

  • This patch fails Spark unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@SparkQA

Copy link
Copy Markdown

Test build #60677 has finished for PR 13720 at commit 25510f5.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds the following public classes (experimental):
    • public class JavaIsotonicRegressionExample

@bomeng

Copy link
Copy Markdown
ContributorAuthor

@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),

Copy link
Copy Markdown
Member

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.

@bomengbomengJun 21, 2016

Copy link
Copy Markdown
ContributorAuthor

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";
}

Copy link
Copy Markdown
Member

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.

Copy link
Copy Markdown
Contributor

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?

Copy link
Copy Markdown
Contributor

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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please follow this?

@SparkQA

Copy link
Copy Markdown

Test build #60968 has finished for PR 13720 at commit 90c3ff0.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@bomeng

Copy link
Copy Markdown
ContributorAuthor

@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(""))

Copy link
Copy Markdown
Contributor

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

Copy link
Copy Markdown
Contributor

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.

Copy link
Copy Markdown
Contributor

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.

@cloud-fan

Copy link
Copy Markdown
Contributor

For the test, currently we only have one desc table test in HiveDDLSuite, It will be good if we can have an individual test suite for it.

@bomeng

Copy link
Copy Markdown
ContributorAuthor

ok, i will work on it based on comments. Thanks.

@bomengbomeng changed the title [SPARK-16004] [SQL] improve the display of CatalogTable information[SPARK-16004] [SQL] Correctly display "Last Access Time" of CatalogTableJun 24, 2016
@SparkQA

Copy link
Copy Markdown

Test build #61196 has finished for PR 13720 at commit e93b72a.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@SparkQA

Copy link
Copy Markdown

Test build #61311 has finished for PR 13720 at commit a72800c.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@bomeng

Copy link
Copy Markdown
ContributorAuthor

@cloud-fan please review again, thanks.

@gatorsmile

Copy link
Copy Markdown
Member

@bomeng Cloud you resolve the conflicts?

}
}

test("Describe Table") {

Copy link
Copy Markdown
Member

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

@HyukjinKwon

Copy link
Copy Markdown
Member

ping @bomeng

@HyukjinKwonHyukjinKwon mentioned this pull request Jun 7, 2017
@asfgitasfgit closed this in b771fedJun 8, 2017
zifeif2 pushed a commit to zifeif2/spark that referenced this pull request Nov 22, 2025
# What changes were proposed in this pull request?
This PR proposes to close stale PRs, mostly the same instances with apache#18017Closesapache#11459Closesapache#13833Closesapache#13720Closesapache#12506Closesapache#12456Closesapache#12252Closesapache#17689Closesapache#17791Closesapache#18163Closesapache#17640Closesapache#17926Closesapache#18163Closesapache#12506Closesapache#18044Closesapache#14036Closesapache#15831Closesapache#14461Closesapache#17638Closesapache#18222
Added:
Closesapache#18045Closesapache#18061Closesapache#18010Closesapache#18041Closesapache#18124Closesapache#18130Closesapache#12217
Added:
Closesapache#16291Closesapache#17480Closesapache#14995
Added:
Closesapache#12835Closesapache#17141
## How was this patch tested?
N/A
Author: hyukjinkwon <gurwls223@gmail.com>
Closesapache#18223 from HyukjinKwon/close-stale-prs.
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants

@bomeng@SparkQA@cloud-fan@gatorsmile@HyukjinKwon@liancheng@srowen@yhuai