diff options
author | Dongjoon Hyun <dongjoon@apache.org> | 2016-03-10 15:57:22 -0800 |
---|---|---|
committer | Andrew Or <andrew@databricks.com> | 2016-03-10 15:57:22 -0800 |
commit | 91fed8e9c57764eca9463d129ecd68196db7f566 (patch) | |
tree | b06c678dc15258af92116019760e6b9c98d81c2d /sql/core/src/main/scala/org/apache | |
parent | 81d48532d954a8aea28d7e1fb3aa32a78c708b63 (diff) | |
download | spark-91fed8e9c57764eca9463d129ecd68196db7f566.tar.gz spark-91fed8e9c57764eca9463d129ecd68196db7f566.tar.bz2 spark-91fed8e9c57764eca9463d129ecd68196db7f566.zip |
[SPARK-3854][BUILD] Scala style: require spaces before `{`.
## What changes were proposed in this pull request?
Since the opening curly brace, '{', has many usages as discussed in [SPARK-3854](https://issues.apache.org/jira/browse/SPARK-3854), this PR adds a ScalaStyle rule to prevent '){' pattern for the following majority pattern and fixes the code accordingly. If we enforce this in ScalaStyle from now, it will improve the Scala code quality and reduce review time.
```
// Correct:
if (true) {
println("Wow!")
}
// Incorrect:
if (true){
println("Wow!")
}
```
IntelliJ also shows new warnings based on this.
## How was this patch tested?
Pass the Jenkins ScalaStyle test.
Author: Dongjoon Hyun <dongjoon@apache.org>
Closes #11637 from dongjoon-hyun/SPARK-3854.
Diffstat (limited to 'sql/core/src/main/scala/org/apache')
4 files changed, 4 insertions, 4 deletions
diff --git a/sql/core/src/main/scala/org/apache/spark/sql/DataFrame.scala b/sql/core/src/main/scala/org/apache/spark/sql/DataFrame.scala index 339e61e572..24f61992d4 100644 --- a/sql/core/src/main/scala/org/apache/spark/sql/DataFrame.scala +++ b/sql/core/src/main/scala/org/apache/spark/sql/DataFrame.scala @@ -1147,7 +1147,7 @@ class DataFrame private[sql]( * columns of the input row are implicitly joined with each value that is output by the function. * * {{{ - * df.explode("words", "word"){words: String => words.split(" ")} + * df.explode("words", "word") {words: String => words.split(" ")} * }}} * @group dfops * @since 1.3.0 diff --git a/sql/core/src/main/scala/org/apache/spark/sql/Dataset.scala b/sql/core/src/main/scala/org/apache/spark/sql/Dataset.scala index dd1fbcf3c8..daddf6e0c5 100644 --- a/sql/core/src/main/scala/org/apache/spark/sql/Dataset.scala +++ b/sql/core/src/main/scala/org/apache/spark/sql/Dataset.scala @@ -605,7 +605,7 @@ class Dataset[T] private[sql]( * duplicate items. As such, it is analogous to `UNION ALL` in SQL. * @since 1.6.0 */ - def union(other: Dataset[T]): Dataset[T] = withPlan[T](other){ (left, right) => + def union(other: Dataset[T]): Dataset[T] = withPlan[T](other) { (left, right) => // This breaks caching, but it's usually ok because it addresses a very specific use case: // using union to union many files or partitions. CombineUnions(Union(left, right)) diff --git a/sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/CompressionCodecs.scala b/sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/CompressionCodecs.scala index 032ba61d9d..41cff07472 100644 --- a/sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/CompressionCodecs.scala +++ b/sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/CompressionCodecs.scala @@ -57,7 +57,7 @@ private[datasources] object CompressionCodecs { * `codec` should be a full class path */ def setCodecConfiguration(conf: Configuration, codec: String): Unit = { - if (codec != null){ + if (codec != null) { conf.set("mapreduce.output.fileoutputformat.compress", "true") conf.set("mapreduce.output.fileoutputformat.compress.type", CompressionType.BLOCK.toString) conf.set("mapreduce.output.fileoutputformat.compress.codec", codec) diff --git a/sql/core/src/main/scala/org/apache/spark/sql/execution/ui/ExecutionPage.scala b/sql/core/src/main/scala/org/apache/spark/sql/execution/ui/ExecutionPage.scala index 49915adf6c..9d3cd9bb14 100644 --- a/sql/core/src/main/scala/org/apache/spark/sql/execution/ui/ExecutionPage.scala +++ b/sql/core/src/main/scala/org/apache/spark/sql/execution/ui/ExecutionPage.scala @@ -114,7 +114,7 @@ private[sql] class ExecutionPage(parent: SQLTab) extends WebUIPage("execution") {metadata} </div> {planVisualizationResources} - <script>$(function(){{ renderPlanViz(); }})</script> + <script>$(function() {{ renderPlanViz(); }})</script> </div> } |