-
Notifications
You must be signed in to change notification settings - Fork 28.4k
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
[SPARK-19402][DOCS] Support LaTex inline formula correctly and fix warnings in Scala/Java APIs generation #16741
Conversation
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.
Yeah generally I'm in favor of changing anything that causes a build failure in Java 8, or doesn't render correctly. Otherwise if it just generates a warning, I'm kind of neutral on it, but not against it.
@@ -58,7 +58,7 @@ trait FutureAction[T] extends Future[T] { | |||
* | |||
* @param atMost maximum wait time, which may be negative (no waiting is done), Duration.Inf | |||
* for unbounded waiting, or a finite positive duration | |||
* @throws Exception exception during action execution | |||
* @note Throws `Exception` exception during action execution |
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.
Ugh, this still generates warnings in unidoc? Does it actually render correctly anyway?
If it renders correctly, I'm inclined to keep it, as long as it doesn't fail the build.
If it didn't render correctly to begin with, OK.
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.
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 see. Yeah it's unfortunate that this (and other) classes aren't found by unidoc. They're JDK classes! I don't see what we could be doing wrong though,
In other cases it's easy enough to change [[
to a back-tick to work around the warning. Here you'd have to mis-use scaladoc a bit to work around it. I think you could leave this, IMHO. The other [[
changes make sense.
@srowen,
Uh, I just saw #16741 (comment). Then, should I maybe revert only |
Actually, I am still neutral on this and confused which way is more correct. It warns anyhow but IMHO changing |
I mean.. it'd be surely better to change it to back-ticks if this breaks but it just warns.. (It is funny that I am saying my proposal should be fixed though). Let me follow your lead please. |
Oh, wait.... it seems case-by-case. Let me leave some before-after image with some explanation soon. |
Test build #72152 has finished for PR 16741 at commit
|
@@ -262,7 +262,7 @@ class SparkConf(loadDefaults: Boolean) extends Cloneable with Logging with Seria | |||
/** | |||
* Get a time parameter as seconds; throws a NoSuchElementException if it's not set. If no | |||
* suffix is provided then seconds are assumed. | |||
* @throws java.util.NoSuchElementException | |||
* @throws java.util.NoSuchElementException If the time parameter is not set |
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.
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.
And.. here is my observation so far.
Notation | Scaladoc | Javadoc | Link | Error/Warn | etc. |
---|---|---|---|---|---|
`DataFrame` |
Renders OK | Renders OK | X | X | |
[[DataFrame]] |
Renders OK | Renders OK | Scaladoc only | Error in javadoc8 | Fixed in #16013 |
@throws IllegalArgumentException ... |
Renders OK | Renders OK | X | Warn | |
@throws java.util.NoSuchElementException ... |
Renders OK | Renders OK | X | Warn | |
@throws java.util.NoSuchElementException [NO DESCRIPTION] |
X | Renders OK | X | Warn | Fixed here |
@@ -78,7 +78,7 @@ abstract class Gradient extends Serializable { | |||
* | |||
* for K classes multiclass classification problem. | |||
* | |||
* The model weights $w = (w_1, w_2, ..., w_{K-1})^T$ becomes a matrix which has dimension of | |||
* The model weights \(w = (w_1, w_2, ..., w_{K-1})^T\) becomes a matrix which has dimension of |
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.
* $margins_i = x w_i$. | ||
* where $\alpha(i) = 1$ if \(i \ne 0\), and | ||
* $\alpha(i) = 0$ if \(i == 0\), | ||
* \(margins_i = x w_i\). |
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.
* where $\delta_{i, j} = 1$ if $i == j$, | ||
* $\delta_{i, j} = 0$ if $i != j$, and | ||
* where $\delta_{i, j} = 1$ if \(i == j\), | ||
* $\delta_{i, j} = 0$ if \(i != j\), and |
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.
Test build #72156 has finished for PR 16741 at commit
|
Test build #72157 has finished for PR 16741 at commit
|
merged to master |
Thank you @srowen! |
Thanks for these many cleanups! It's a shame to lose links. Do you think we should use fully qualified names rather than abandoning the links? |
I don't think it's a matter of fully-qualified names; it knows what the type is just thinks it can't find it for some reason and raises a warning/error. |
Yes, it can't find. I trieid several possible combinations such as fully qualified name, [[ .. ]] and scala specific notations but I had no luck. |
@@ -135,13 +135,13 @@ abstract class MLWriter extends BaseReadWrite with Logging { | |||
} | |||
|
|||
/** | |||
* Trait for classes that provide [[MLWriter]]. | |||
* Trait for classes that provide `MLWriter`. |
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.
@HyukjinKwon Are you sure this is a problem? I just tried generating the docs using Java 8, and the link with [[MLWriter]]
worked for both Scala and Java. Maybe it is fine for some cases (like this, where MLWriter is part of the package being compiled) and not for other cases (such as when the class is from a dependency).
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.
Hmm. That's weird. At least, it should warn because I copied and pasted each class names from the messages and went to the file said in the message. Let me double check and be back. Maybe, I made mistakes for few.
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.
@jkbradley, I see. This one seems fine for both.
I think I changed them given def write: MLWriter
below...
[warn] .../spark/mllib/src/main/scala/org/apache/spark/ml/util/ReadWrite.scala:143: Could not find any member to link for "MLWriter".
[warn] /**
[warn] ^
and I think I swept them here as they looked identical. I am okay to revive identified ones back.
My (maybe nitpicking) concern is, we should be able to identify the cases explicitly and what to do in each case which I guess I and many guys failed to do so. Otherwise, I think we should prefer backquotes in such cases because even if reviving links might work for now for some cases, we could easily introduce other breaks again when we change the codes.
…rnings in Scala/Java APIs generation ## What changes were proposed in this pull request? This PR proposes three things as below: - Support LaTex inline-formula, `\( ... \)` in Scala API documentation It seems currently, ``` \( ... \) ``` are rendered as they are, for example, <img width="345" alt="2017-01-30 10 01 13" src="https://cloud.githubusercontent.com/assets/6477701/22423960/ab37d54a-e737-11e6-9196-4f6229c0189c.png"> It seems mistakenly more backslashes were added. - Fix warnings Scaladoc/Javadoc generation This PR fixes t two types of warnings as below: ``` [warn] .../spark/sql/catalyst/src/main/scala/org/apache/spark/sql/Row.scala:335: Could not find any member to link for "UnsupportedOperationException". [warn] /** [warn] ^ ``` ``` [warn] .../spark/sql/core/src/main/scala/org/apache/spark/sql/internal/VariableSubstitution.scala:24: Variable var undefined in comment for class VariableSubstitution in class VariableSubstitution [warn] * `${var}`, `${system:var}` and `${env:var}`. [warn] ^ ``` - Fix Javadoc8 break ``` [error] .../spark/mllib/target/java/org/apache/spark/ml/PredictionModel.java:7: error: reference not found [error] * E.g., {link VectorUDT} for vector features. [error] ^ [error] .../spark/mllib/target/java/org/apache/spark/ml/PredictorParams.java:12: error: reference not found [error] * E.g., {link VectorUDT} for vector features. [error] ^ [error] .../spark/mllib/target/java/org/apache/spark/ml/Predictor.java:10: error: reference not found [error] * E.g., {link VectorUDT} for vector features. [error] ^ [error] .../spark/sql/hive/target/java/org/apache/spark/sql/hive/HiveAnalysis.java:5: error: reference not found [error] * Note that, this rule must be run after {link PreprocessTableInsertion}. [error] ^ ``` ## How was this patch tested? Manually via `sbt unidoc` and `jeykil build`. Author: hyukjinkwon <[email protected]> Closes apache#16741 from HyukjinKwon/warn-and-break.
What changes were proposed in this pull request?
This PR proposes three things as below:
Support LaTex inline-formula,
\( ... \)
in Scala API documentationIt seems currently,
are rendered as they are, for example,
It seems mistakenly more backslashes were added.
Fix warnings Scaladoc/Javadoc generation
This PR fixes t two types of warnings as below:
Fix Javadoc8 break
How was this patch tested?
Manually via
sbt unidoc
andjeykil build
.