Skip to content
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

[MINOR][SQL][DOCS] Improve unix_timestamp's scaladoc (and typo hunting) #17801

Closed
wants to merge 7 commits into from

Conversation

jaceklaskowski
Copy link
Contributor

What changes were proposed in this pull request?

  • Docs are consistent (across different unix_timestamp variants and their internal expressions)
  • typo hunting

How was this patch tested?

local build

@SparkQA
Copy link

SparkQA commented Apr 28, 2017

Test build #76266 has finished for PR 17801 at commit 20edec8.

  • This patch fails to generate documentation.
  • This patch merges cleanly.
  • This patch adds no public classes.

/**
* Converts a date/timestamp/string to a value of string in the format specified by the date
* format given by the second argument.
*
* A pattern could be for instance `dd.MM.yyyy` and could return a string like '18.03.1993'. All
* pattern letters of `java.text.SimpleDateFormat` can be used.
* pattern letters of [[https://docs.oracle.com/javase/8/docs/api/java/text/SimpleDateFormat.html java.text.SimpleDateFormat]] can be used.
Copy link
Member

Choose a reason for hiding this comment

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

We don't generally link to external javadoc, and we've had problems creating a normal javadoc link to the class in many instances. For consistency, I wouldn't bother with this.

@SparkQA
Copy link

SparkQA commented Apr 28, 2017

Test build #76267 has finished for PR 17801 at commit c3cc96b.

  • This patch fails to generate documentation.
  • This patch merges cleanly.
  • This patch adds no public classes.

@jaceklaskowski
Copy link
Contributor Author

Are the errors (that led to fails to generate documentation) after my change? Look very weird to me.

[error] /home/jenkins/workspace/SparkPullRequestBuilder/core/target/java/org/apache/spark/scheduler/BlacklistTracker.java:117: error: ExecutorAllocationClient is not public in org.apache.spark; cannot be accessed from outside package
[error]   public   BlacklistTracker (org.apache.spark.scheduler.LiveListenerBus listenerBus, org.apache.spark.SparkConf conf, scala.Option<org.apache.spark.ExecutorAllocationClient> allocationClient, org.apache.spark.util.Clock clock)  { throw new RuntimeException(); }
[error]                                                                                                                                                    ^
[error] /home/jenkins/workspace/SparkPullRequestBuilder/core/target/java/org/apache/spark/scheduler/BlacklistTracker.java:118: error: ExecutorAllocationClient is not public in org.apache.spark; cannot be accessed from outside package
[error]   public   BlacklistTracker (org.apache.spark.SparkContext sc, scala.Option<org.apache.spark.ExecutorAllocationClient> allocationClient)  { throw new RuntimeException(); }
[error]                                                                                             ^
[error] /home/jenkins/workspace/SparkPullRequestBuilder/core/target/java/org/apache/spark/SparkConf.java:133: error: ConfigReader is not public in org.apache.spark.internal.config; cannot be accessed from outside package
[error]   private  org.apache.spark.internal.config.ConfigReader reader ()  { throw new RuntimeException(); }
[error]                                            ^
[error] /home/jenkins/workspace/SparkPullRequestBuilder/core/target/java/org/apache/spark/SparkConf.java:138: error: ConfigEntry is not public in org.apache.spark.internal.config; cannot be accessed from outside package
[error]    <T extends java.lang.Object> org.apache.spark.SparkConf set (org.apache.spark.internal.config.ConfigEntry<T> entry, T value)  { throw new RuntimeException(); }
[error]                                                                                                 ^
[error] /home/jenkins/workspace/SparkPullRequestBuilder/core/target/java/org/apache/spark/SparkConf.java:139: error: OptionalConfigEntry is not public in org.apache.spark.internal.config; cannot be accessed from outside package
[error]    <T extends java.lang.Object> org.apache.spark.SparkConf set (org.apache.spark.internal.config.OptionalConfigEntry<T> entry, T value)  { throw new RuntimeException(); }
[error]                                                                                                 ^
[error] /home/jenkins/workspace/SparkPullRequestBuilder/core/target/java/org/apache/spark/SparkConf.java:187: error: ConfigEntry is not public in org.apache.spark.internal.config; cannot be accessed from outside package
[error]    <T extends java.lang.Object> org.apache.spark.SparkConf setIfMissing (org.apache.spark.internal.config.ConfigEntry<T> entry, T value)  { throw new RuntimeException(); }
[error]                                                                                                          ^
[error] /home/jenkins/workspace/SparkPullRequestBuilder/core/target/java/org/apache/spark/SparkConf.java:188: error: OptionalConfigEntry is not public in org.apache.spark.internal.config; cannot be accessed from outside package
[error]    <T extends java.lang.Object> org.apache.spark.SparkConf setIfMissing (org.apache.spark.internal.config.OptionalConfigEntry<T> entry, T value)  { throw new RuntimeException(); }
[error]                                                                                                          ^
[error] /home/jenkins/workspace/SparkPullRequestBuilder/core/target/java/org/apache/spark/SparkConf.java:208: error: ConfigEntry is not public in org.apache.spark.internal.config; cannot be accessed from outside package
[error]     org.apache.spark.SparkConf remove (org.apache.spark.internal.config.ConfigEntry<?> entry)  { throw new RuntimeException(); }

* Converts time string with given pattern to Unix timestamp (in seconds).
* Returns `null` if fails.
*
* @see [[http://docs.oracle.com/javase/tutorial/i18n/format/simpleDateFormat.html Customizing Formats]]
Copy link
Member

Choose a reason for hiding this comment

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

It looks the documentation generation for Javadoc 8 is being failed due to @see with link -

[error] /home/jenkins/workspace/SparkPullRequestBuilder/sql/core/target/java/org/apache/spark/sql/functions.java:2996: error: self-closing element not allowed
[error]    * @see <a href="http://docs.oracle.com/javase/tutorial/i18n/format/simpleDateFormat.html Customizing Formats"/>
[error]           ^
[error] /home/jenkins/workspace/SparkPullRequestBuilder/sql/core/target/java/org/apache/spark/sql/functions.java:2996: error: invalid uri: "http://docs.oracle.com/javase/tutorial/i18n/format/simpleDateFormat.html Customizing Formats"
[error]    * @see <a href="http://docs.oracle.com/javase/tutorial/i18n/format/simpleDateFormat.html Customizing Formats"/>
[error]                                                                     ^

Probably, we should wrap it href as I did before - #16013 or find a way to make this link properly (or just remove it).

The other errors seem spurious. Please refer my observation - #17389 (comment)

Copy link
Member

@HyukjinKwon HyukjinKwon left a comment

Choose a reason for hiding this comment

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

These are all from me.

* Gets current Unix timestamp in seconds.
* Returns the current Unix timestamp (in seconds).
*
* NOTE: All calls of `unix_timestamp` within the same query return the same value
Copy link
Member

Choose a reason for hiding this comment

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

Should we use @note and fix the corresponding contents in Python and R if applicable?

* Converts time string with given pattern to Unix timestamp (in seconds).
* Returns `null` if fails.
*
* @see <a href="http://docs.oracle.com/javase/tutorial/i18n/format/simpleDateFormat.html">Customizing Formats</a>
Copy link
Member

Choose a reason for hiding this comment

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

@see <a href="http://docs.oracle.com/javase/tutorial/i18n/format/simpleDateFormat.html">
Customizing Formats</a>

Given my past try, the above one works - #15999 (comment) (IIRC, I checked the output).

Copy link
Member

Choose a reason for hiding this comment

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

that can avoid having scalastyle:off

@SparkQA
Copy link

SparkQA commented May 6, 2017

Test build #76528 has finished for PR 17801 at commit 5326ad1.

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

@SparkQA
Copy link

SparkQA commented May 7, 2017

Test build #76546 has finished for PR 17801 at commit c96f137.

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

Copy link
Member

@gatorsmile gatorsmile left a comment

Choose a reason for hiding this comment

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

LGTM

@gatorsmile
Copy link
Member

Thanks! Merging to master.

@asfgit asfgit closed this in 500436b May 7, 2017
@jaceklaskowski jaceklaskowski deleted the unix_timestamp branch May 8, 2017 10:03
liyichao pushed a commit to liyichao/spark that referenced this pull request May 24, 2017
## What changes were proposed in this pull request?

* Docs are consistent (across different `unix_timestamp` variants and their internal expressions)
* typo hunting

## How was this patch tested?

local build

Author: Jacek Laskowski <[email protected]>

Closes apache#17801 from jaceklaskowski/unix_timestamp.
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.

6 participants