@@ -19,9 +19,10 @@ package org.apache.spark.sql
1919
2020import scala .collection .JavaConverters ._
2121import scala .language .implicitConversions
22- import scala .reflect .runtime .universe .{TypeTag , typeTag }
22+ import scala .reflect .runtime .universe .{typeTag , TypeTag }
2323import scala .util .Try
2424import scala .util .control .NonFatal
25+
2526import org .apache .spark .annotation .{Experimental , InterfaceStability }
2627import org .apache .spark .sql .catalyst .ScalaReflection
2728import 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