@@ -19,17 +19,16 @@ 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-
2625import org .apache .spark .annotation .{Experimental , InterfaceStability }
2726import org .apache .spark .sql .catalyst .ScalaReflection
2827import org .apache .spark .sql .catalyst .analysis .{Star , UnresolvedFunction }
2928import org .apache .spark .sql .catalyst .encoders .ExpressionEncoder
3029import org .apache .spark .sql .catalyst .expressions ._
3130import org .apache .spark .sql .catalyst .expressions .aggregate ._
32- import org .apache .spark .sql .catalyst .plans .logical .BroadcastHint
31+ import org .apache .spark .sql .catalyst .plans .logical .{ BroadcastHint , NoCollapseHint }
3332import org .apache .spark .sql .execution .SparkSqlParser
3433import org .apache .spark .sql .expressions .UserDefinedFunction
3534import org .apache .spark .sql .internal .SQLConf
@@ -1007,21 +1006,37 @@ object functions {
10071006 def map (cols : Column * ): Column = withExpr { CreateMap (cols.map(_.expr)) }
10081007
10091008 /**
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- */
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+ */
10211020 def broadcast [T ](df : Dataset [T ]): Dataset [T ] = {
10221021 Dataset [T ](df.sparkSession, BroadcastHint (df.logicalPlan))(df.exprEnc)
10231022 }
10241023
1024+ /**
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+ */
1036+ def no_collapse [T ](df : Dataset [T ]): Dataset [T ] = {
1037+ Dataset [T ](df.sparkSession, NoCollapseHint (df.logicalPlan))(df.exprEnc)
1038+ }
1039+
10251040 /**
10261041 * Returns the first column that is not null, or null if all inputs are null.
10271042 *
0 commit comments