Skip to content

Commit a4ac590

Browse files
HyukjinKwoncmonkey
authored andcommitted
[SPARK-19402][DOCS] Support LaTex inline formula correctly and fix warnings 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.
1 parent 282f635 commit a4ac590

File tree

42 files changed

+124
-119
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+124
-119
lines changed

core/src/main/scala/org/apache/spark/SparkConf.scala

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ class SparkConf(loadDefaults: Boolean) extends Cloneable with Logging with Seria
262262
/**
263263
* Get a time parameter as seconds; throws a NoSuchElementException if it's not set. If no
264264
* suffix is provided then seconds are assumed.
265-
* @throws java.util.NoSuchElementException
265+
* @throws java.util.NoSuchElementException If the time parameter is not set
266266
*/
267267
def getTimeAsSeconds(key: String): Long = {
268268
Utils.timeStringAsSeconds(get(key))
@@ -279,7 +279,7 @@ class SparkConf(loadDefaults: Boolean) extends Cloneable with Logging with Seria
279279
/**
280280
* Get a time parameter as milliseconds; throws a NoSuchElementException if it's not set. If no
281281
* suffix is provided then milliseconds are assumed.
282-
* @throws java.util.NoSuchElementException
282+
* @throws java.util.NoSuchElementException If the time parameter is not set
283283
*/
284284
def getTimeAsMs(key: String): Long = {
285285
Utils.timeStringAsMs(get(key))
@@ -296,7 +296,7 @@ class SparkConf(loadDefaults: Boolean) extends Cloneable with Logging with Seria
296296
/**
297297
* Get a size parameter as bytes; throws a NoSuchElementException if it's not set. If no
298298
* suffix is provided then bytes are assumed.
299-
* @throws java.util.NoSuchElementException
299+
* @throws java.util.NoSuchElementException If the size parameter is not set
300300
*/
301301
def getSizeAsBytes(key: String): Long = {
302302
Utils.byteStringAsBytes(get(key))
@@ -320,7 +320,7 @@ class SparkConf(loadDefaults: Boolean) extends Cloneable with Logging with Seria
320320
/**
321321
* Get a size parameter as Kibibytes; throws a NoSuchElementException if it's not set. If no
322322
* suffix is provided then Kibibytes are assumed.
323-
* @throws java.util.NoSuchElementException
323+
* @throws java.util.NoSuchElementException If the size parameter is not set
324324
*/
325325
def getSizeAsKb(key: String): Long = {
326326
Utils.byteStringAsKb(get(key))
@@ -337,7 +337,7 @@ class SparkConf(loadDefaults: Boolean) extends Cloneable with Logging with Seria
337337
/**
338338
* Get a size parameter as Mebibytes; throws a NoSuchElementException if it's not set. If no
339339
* suffix is provided then Mebibytes are assumed.
340-
* @throws java.util.NoSuchElementException
340+
* @throws java.util.NoSuchElementException If the size parameter is not set
341341
*/
342342
def getSizeAsMb(key: String): Long = {
343343
Utils.byteStringAsMb(get(key))
@@ -354,7 +354,7 @@ class SparkConf(loadDefaults: Boolean) extends Cloneable with Logging with Seria
354354
/**
355355
* Get a size parameter as Gibibytes; throws a NoSuchElementException if it's not set. If no
356356
* suffix is provided then Gibibytes are assumed.
357-
* @throws java.util.NoSuchElementException
357+
* @throws java.util.NoSuchElementException If the size parameter is not set
358358
*/
359359
def getSizeAsGb(key: String): Long = {
360360
Utils.byteStringAsGb(get(key))

core/src/main/scala/org/apache/spark/rdd/PairRDDFunctions.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,7 @@ class PairRDDFunctions[K, V](self: RDD[(K, V)])
496496
* or `PairRDDFunctions.reduceByKey` will provide much better performance.
497497
*
498498
* @note As currently implemented, groupByKey must be able to hold all the key-value pairs for any
499-
* key in memory. If a key has too many values, it can result in an [[OutOfMemoryError]].
499+
* key in memory. If a key has too many values, it can result in an `OutOfMemoryError`.
500500
*/
501501
def groupByKey(partitioner: Partitioner): RDD[(K, Iterable[V])] = self.withScope {
502502
// groupByKey shouldn't use map side combine because map side combine does not
@@ -520,7 +520,7 @@ class PairRDDFunctions[K, V](self: RDD[(K, V)])
520520
* or `PairRDDFunctions.reduceByKey` will provide much better performance.
521521
*
522522
* @note As currently implemented, groupByKey must be able to hold all the key-value pairs for any
523-
* key in memory. If a key has too many values, it can result in an [[OutOfMemoryError]].
523+
* key in memory. If a key has too many values, it can result in an `OutOfMemoryError`.
524524
*/
525525
def groupByKey(numPartitions: Int): RDD[(K, Iterable[V])] = self.withScope {
526526
groupByKey(new HashPartitioner(numPartitions))

core/src/main/scala/org/apache/spark/scheduler/SparkListener.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ private[spark] trait SparkListenerInterface {
294294

295295
/**
296296
* :: DeveloperApi ::
297-
* A default implementation for [[SparkListenerInterface]] that has no-op implementations for
297+
* A default implementation for `SparkListenerInterface` that has no-op implementations for
298298
* all callbacks.
299299
*
300300
* Note that this is an internal interface which might change in different Spark releases.

core/src/main/scala/org/apache/spark/scheduler/package.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
package org.apache.spark
1919

2020
/**
21-
* Spark's scheduling components. This includes the [[org.apache.spark.scheduler.DAGScheduler]] and
22-
* lower level [[org.apache.spark.scheduler.TaskScheduler]].
21+
* Spark's scheduling components. This includes the `org.apache.spark.scheduler.DAGScheduler` and
22+
* lower level `org.apache.spark.scheduler.TaskScheduler`.
2323
*/
2424
package object scheduler

core/src/main/scala/org/apache/spark/storage/TopologyMapper.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ class DefaultTopologyMapper(conf: SparkConf) extends TopologyMapper(conf) with L
6060

6161
/**
6262
* A simple file based topology mapper. This expects topology information provided as a
63-
* [[java.util.Properties]] file. The name of the file is obtained from SparkConf property
63+
* `java.util.Properties` file. The name of the file is obtained from SparkConf property
6464
* `spark.storage.replication.topologyFile`. To use this topology mapper, set the
6565
* `spark.storage.replication.topologyMapper` property to
6666
* [[org.apache.spark.storage.FileBasedTopologyMapper]]

docs/js/api-docs.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ $(document).ready(function() {
5050
MathJax.Hub.Config({
5151
displayAlign: "left",
5252
tex2jax: {
53-
inlineMath: [ ["$", "$"], ["\\\\(","\\\\)"] ],
53+
inlineMath: [ ["$", "$"], ["\\(","\\)"] ],
5454
displayMath: [ ["$$","$$"], ["\\[", "\\]"] ],
5555
processEscapes: true,
5656
skipTags: ['script', 'noscript', 'style', 'textarea', 'pre', 'a']

mllib-local/src/main/scala/org/apache/spark/ml/linalg/Vectors.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ sealed trait Vector extends Serializable {
169169
/**
170170
* Factory methods for [[org.apache.spark.ml.linalg.Vector]].
171171
* We don't use the name `Vector` because Scala imports
172-
* [[scala.collection.immutable.Vector]] by default.
172+
* `scala.collection.immutable.Vector` by default.
173173
*/
174174
@Since("2.0.0")
175175
object Vectors {

mllib/src/main/scala/org/apache/spark/ml/Predictor.scala

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ private[ml] trait PredictorParams extends Params
4040
* @param schema input schema
4141
* @param fitting whether this is in fitting
4242
* @param featuresDataType SQL DataType for FeaturesType.
43-
* E.g., [[VectorUDT]] for vector features.
43+
* E.g., `VectorUDT` for vector features.
4444
* @return output schema
4545
*/
4646
protected def validateAndTransformSchema(
@@ -72,7 +72,7 @@ private[ml] trait PredictorParams extends Params
7272
* in `fit()`.
7373
*
7474
* @tparam FeaturesType Type of features.
75-
* E.g., [[VectorUDT]] for vector features.
75+
* E.g., `VectorUDT` for vector features.
7676
* @tparam Learner Specialization of this class. If you subclass this type, use this type
7777
* parameter to specify the concrete type.
7878
* @tparam M Specialization of [[PredictionModel]]. If you subclass this type, use this type
@@ -122,7 +122,7 @@ abstract class Predictor[
122122

123123
/**
124124
* Train a model using the given dataset and parameters.
125-
* Developers can implement this instead of [[fit()]] to avoid dealing with schema validation
125+
* Developers can implement this instead of `fit()` to avoid dealing with schema validation
126126
* and copying parameters into the model.
127127
*
128128
* @param dataset Training dataset
@@ -133,7 +133,7 @@ abstract class Predictor[
133133
/**
134134
* Returns the SQL DataType corresponding to the FeaturesType type parameter.
135135
*
136-
* This is used by [[validateAndTransformSchema()]].
136+
* This is used by `validateAndTransformSchema()`.
137137
* This workaround is needed since SQL has different APIs for Scala and Java.
138138
*
139139
* The default value is VectorUDT, but it may be overridden if FeaturesType is not Vector.
@@ -160,7 +160,7 @@ abstract class Predictor[
160160
* Abstraction for a model for prediction tasks (regression and classification).
161161
*
162162
* @tparam FeaturesType Type of features.
163-
* E.g., [[VectorUDT]] for vector features.
163+
* E.g., `VectorUDT` for vector features.
164164
* @tparam M Specialization of [[PredictionModel]]. If you subclass this type, use this type
165165
* parameter to specify the concrete type for the corresponding model.
166166
*/
@@ -181,7 +181,7 @@ abstract class PredictionModel[FeaturesType, M <: PredictionModel[FeaturesType,
181181
/**
182182
* Returns the SQL DataType corresponding to the FeaturesType type parameter.
183183
*
184-
* This is used by [[validateAndTransformSchema()]].
184+
* This is used by `validateAndTransformSchema()`.
185185
* This workaround is needed since SQL has different APIs for Scala and Java.
186186
*
187187
* The default value is VectorUDT, but it may be overridden if FeaturesType is not Vector.
@@ -197,7 +197,7 @@ abstract class PredictionModel[FeaturesType, M <: PredictionModel[FeaturesType,
197197
* the predictions as a new column [[predictionCol]].
198198
*
199199
* @param dataset input dataset
200-
* @return transformed dataset with [[predictionCol]] of type [[Double]]
200+
* @return transformed dataset with [[predictionCol]] of type `Double`
201201
*/
202202
override def transform(dataset: Dataset[_]): DataFrame = {
203203
transformSchema(dataset.schema, logging = true)
@@ -219,7 +219,7 @@ abstract class PredictionModel[FeaturesType, M <: PredictionModel[FeaturesType,
219219

220220
/**
221221
* Predict label for the given features.
222-
* This internal method is used to implement [[transform()]] and output [[predictionCol]].
222+
* This internal method is used to implement `transform()` and output [[predictionCol]].
223223
*/
224224
protected def predict(features: FeaturesType): Double
225225
}

mllib/src/main/scala/org/apache/spark/ml/attribute/attributes.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ private[attribute] trait AttributeFactory {
126126
private[attribute] def fromMetadata(metadata: Metadata): Attribute
127127

128128
/**
129-
* Creates an [[Attribute]] from a [[StructField]] instance, optionally preserving name.
129+
* Creates an [[Attribute]] from a `StructField` instance, optionally preserving name.
130130
*/
131131
private[ml] def decodeStructField(field: StructField, preserveName: Boolean): Attribute = {
132132
require(field.dataType.isInstanceOf[NumericType])
@@ -145,7 +145,7 @@ private[attribute] trait AttributeFactory {
145145
}
146146

147147
/**
148-
* Creates an [[Attribute]] from a [[StructField]] instance.
148+
* Creates an [[Attribute]] from a `StructField` instance.
149149
*/
150150
def fromStructField(field: StructField): Attribute = decodeStructField(field, false)
151151
}

mllib/src/main/scala/org/apache/spark/ml/attribute/package.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import org.apache.spark.sql.DataFrame
2323
/**
2424
* ==ML attributes==
2525
*
26-
* The ML pipeline API uses [[DataFrame]]s as ML datasets.
26+
* The ML pipeline API uses `DataFrame`s as ML datasets.
2727
* Each dataset consists of typed columns, e.g., string, double, vector, etc.
2828
* However, knowing only the column type may not be sufficient to handle the data properly.
2929
* For instance, a double column with values 0.0, 1.0, 2.0, ... may represent some label indices,

0 commit comments

Comments
 (0)