Skip to content

Commit 3986247

Browse files
committed
Resolve scalastyle errors.
1 parent 3f1e6a1 commit 3986247

3 files changed

Lines changed: 25 additions & 29 deletions

File tree

python/pyspark/sql/functions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,7 @@ def nanvl(col1, col2):
468468

469469
@since(2.2)
470470
def no_collapse(df):
471-
"""Marks a DataFrame as small enough for use in broadcast joins."""
471+
"""Marks a DataFrame as non-collapsible."""
472472

473473
sc = SparkContext._active_spark_context
474474
return DataFrame(sc._jvm.functions.no_collapse(df._jdf), df.sql_ctx)

sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/parser/PlanParserSuite.scala

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -537,10 +537,5 @@ class PlanParserSuite extends PlanTest {
537537
comparePlans(
538538
parsePlan("SELECT /*+ MAPJOIN(t) */ a from t where true group by a order by a"),
539539
Hint("MAPJOIN", Seq("t"), table("t").where(Literal(true)).groupBy('a)('a)).orderBy('a.asc))
540-
541-
comparePlans(
542-
parsePlan("SELECT a FROM (SELECT /*+ NO_COLLAPSE */ * FROM t) t1"),
543-
SubqueryAlias("t1", Hint("NO_COLLAPSE", Seq.empty, table("t").select(star())))
544-
.select('a))
545540
}
546541
}

sql/core/src/main/scala/org/apache/spark/sql/functions.scala

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,10 @@ package org.apache.spark.sql
1919

2020
import scala.collection.JavaConverters._
2121
import scala.language.implicitConversions
22-
import scala.reflect.runtime.universe.{TypeTag, typeTag}
22+
import scala.reflect.runtime.universe.{typeTag, TypeTag}
2323
import scala.util.Try
2424
import scala.util.control.NonFatal
25+
2526
import org.apache.spark.annotation.{Experimental, InterfaceStability}
2627
import org.apache.spark.sql.catalyst.ScalaReflection
2728
import org.apache.spark.sql.catalyst.analysis.{Star, UnresolvedFunction}
@@ -1006,33 +1007,33 @@ object functions {
10061007
def map(cols: Column*): Column = withExpr { CreateMap(cols.map(_.expr)) }
10071008

10081009
/**
1009-
* Marks a DataFrame as small enough for use in broadcast joins.
1010-
*
1011-
* The following example marks the right DataFrame for broadcast hash join using `joinKey`.
1012-
* {{{
1013-
* // left and right are DataFrames
1014-
* left.join(broadcast(right), "joinKey")
1015-
* }}}
1016-
*
1017-
* @group normal_funcs
1018-
* @since 1.5.0
1019-
*/
1010+
* Marks a DataFrame as small enough for use in broadcast joins.
1011+
*
1012+
* The following example marks the right DataFrame for broadcast hash join using `joinKey`.
1013+
* {{{
1014+
* // left and right are DataFrames
1015+
* left.join(broadcast(right), "joinKey")
1016+
* }}}
1017+
*
1018+
* @group normal_funcs
1019+
* @since 1.5.0
1020+
*/
10201021
def broadcast[T](df: Dataset[T]): Dataset[T] = {
10211022
Dataset[T](df.sparkSession, BroadcastHint(df.logicalPlan))(df.exprEnc)
10221023
}
10231024

10241025
/**
1025-
* Marks a DataFrame as small enough for use in broadcast joins.
1026-
*
1027-
* The following example marks the right DataFrame for broadcast hash join using `joinKey`.
1028-
* {{{
1029-
* // left and right are DataFrames
1030-
* left.join(broadcast(right), "joinKey")
1031-
* }}}
1032-
*
1033-
* @group normal_funcs
1034-
* @since 1.5.0
1035-
*/
1026+
* Marks a DataFrame as non-collapsible.
1027+
*
1028+
* For example:
1029+
* {{{
1030+
* df1 = no_collapse(df.select((df.col("qty") * lit(10).alias("c1")))
1031+
* df2 = df1.select(col("c1") + lit(1)), col("c1") + lit(2)))
1032+
* }}}
1033+
*
1034+
* @group normal_funcs
1035+
* @since 2.2.0
1036+
*/
10361037
def no_collapse[T](df: Dataset[T]): Dataset[T] = {
10371038
Dataset[T](df.sparkSession, NoCollapseHint(df.logicalPlan))(df.exprEnc)
10381039
}

0 commit comments

Comments
 (0)