From b2b1ad7d4cc3b3469c3d2c841b40b58ed0e34447 Mon Sep 17 00:00:00 2001 From: Reynold Xin Date: Tue, 22 Mar 2016 13:48:03 -0700 Subject: [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 Author: Wenchen Fan Closes #11878 from rxin/SPARK-14060. --- .../src/main/scala/org/apache/spark/sql/SQLContext.scala | 12 ------------ .../src/main/scala/org/apache/spark/sql/SQLImplicits.scala | 11 +++++++++++ .../test/scala/org/apache/spark/sql/test/SQLTestUtils.scala | 7 ------- 3 files changed, 11 insertions(+), 19 deletions(-) diff --git a/sql/core/src/main/scala/org/apache/spark/sql/SQLContext.scala b/sql/core/src/main/scala/org/apache/spark/sql/SQLContext.scala index efaccec262..c070e867c9 100644 --- a/sql/core/src/main/scala/org/apache/spark/sql/SQLContext.scala +++ b/sql/core/src/main/scala/org/apache/spark/sql/SQLContext.scala @@ -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 diff --git a/sql/core/src/main/scala/org/apache/spark/sql/SQLImplicits.scala b/sql/core/src/main/scala/org/apache/spark/sql/SQLImplicits.scala index fd814e0f28..4aab16b866 100644 --- a/sql/core/src/main/scala/org/apache/spark/sql/SQLImplicits.scala +++ b/sql/core/src/main/scala/org/apache/spark/sql/SQLImplicits.scala @@ -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() diff --git a/sql/core/src/test/scala/org/apache/spark/sql/test/SQLTestUtils.scala b/sql/core/src/test/scala/org/apache/spark/sql/test/SQLTestUtils.scala index 926fabe611..ab3876728b 100644 --- a/sql/core/src/test/scala/org/apache/spark/sql/test/SQLTestUtils.scala +++ b/sql/core/src/test/scala/org/apache/spark/sql/test/SQLTestUtils.scala @@ -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: _*)) - } - } } /** -- cgit v1.2.3