Skip to content
Snippets Groups Projects
Commit b2b1ad7d authored by Reynold Xin's avatar Reynold Xin
Browse files

[SPARK-14060][SQL] Move StringToColumn implicit class into SQLImplicits

## What changes were proposed in this pull request?
This patch moves StringToColumn implicit class into SQLImplicits. This was kept in SQLContext.implicits object for binary backward compatibility, in the Spark 1.x series. It makes more sense for this API to be in SQLImplicits since that's the single class that defines all the SQL implicits.

## How was this patch tested?
Should be covered by existing unit tests.

Author: Reynold Xin <rxin@databricks.com>
Author: Wenchen Fan <wenchen@databricks.com>

Closes #11878 from rxin/SPARK-14060.
parent 7e3423b9
No related branches found
No related tags found
No related merge requests found
......@@ -339,18 +339,6 @@ class SQLContext private[sql](
@Experimental
object implicits extends SQLImplicits with Serializable {
protected override def _sqlContext: SQLContext = self
/**
* Converts $"col name" into an [[Column]].
*
* @since 1.3.0
*/
// This must live here to preserve binary compatibility with Spark < 1.5.
implicit class StringToColumn(val sc: StringContext) {
def $(args: Any*): ColumnName = {
new ColumnName(sc.s(args: _*))
}
}
}
// scalastyle:on
......
......@@ -36,6 +36,17 @@ abstract class SQLImplicits {
protected def _sqlContext: SQLContext
/**
* Converts $"col name" into an [[Column]].
*
* @since 2.0.0
*/
implicit class StringToColumn(val sc: StringContext) {
def $(args: Any*): ColumnName = {
new ColumnName(sc.s(args: _*))
}
}
/** @since 1.6.0 */
implicit def newProductEncoder[T <: Product : TypeTag]: Encoder[T] = ExpressionEncoder()
......
......@@ -66,13 +66,6 @@ private[sql] trait SQLTestUtils
*/
protected object testImplicits extends SQLImplicits {
protected override def _sqlContext: SQLContext = self.sqlContext
// This must live here to preserve binary compatibility with Spark < 1.5.
implicit class StringToColumn(val sc: StringContext) {
def $(args: Any*): ColumnName = {
new ColumnName(sc.s(args: _*))
}
}
}
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment