Skip to content

Conversation

@bomeng
Copy link
Contributor

@bomeng bomeng commented Jun 16, 2016

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.

@bomeng bomeng changed the title [SPAKR-16004] [SQL] improve the disply of CatalogTable information [SPAKR-16004] [SQL] improve the display of CatalogTable information Jun 16, 2016
@bomeng bomeng changed the title [SPAKR-16004] [SQL] improve the display of CatalogTable information [SPARK-16004] [SQL] improve the display of CatalogTable information Jun 16, 2016
@SparkQA
Copy link

SparkQA commented Jun 17, 2016

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

SparkQA commented Jun 17, 2016

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
Contributor Author

bomeng commented Jun 20, 2016

@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
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.

Copy link
Contributor Author

@bomeng bomeng Jun 21, 2016

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
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
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
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
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

SparkQA commented Jun 22, 2016

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
Contributor Author

bomeng commented Jun 23, 2016

@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
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
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
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
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
Contributor Author

bomeng commented Jun 24, 2016

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

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

SparkQA commented Jun 24, 2016

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

SparkQA commented Jun 27, 2016

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
Contributor Author

bomeng commented Jun 27, 2016

@cloud-fan please review again, thanks.

@gatorsmile
Copy link
Member

@bomeng Cloud you resolve the conflicts?

}
}

test("Describe Table") {
Copy link
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
Member

ping @bomeng

@asfgit asfgit closed this in b771fed Jun 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#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.
Sign up for free to 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