Repository: spark Updated Branches: refs/heads/master 7e3423b9c -> b2b1ad7d4
[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 <[email protected]> Author: Wenchen Fan <[email protected]> Closes #11878 from rxin/SPARK-14060. Project: http://git-wip-us.apache.org/repos/asf/spark/repo Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/b2b1ad7d Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/b2b1ad7d Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/b2b1ad7d Branch: refs/heads/master Commit: b2b1ad7d4cc3b3469c3d2c841b40b58ed0e34447 Parents: 7e3423b Author: Reynold Xin <[email protected]> Authored: Tue Mar 22 13:48:03 2016 -0700 Committer: Reynold Xin <[email protected]> Committed: Tue Mar 22 13:48:03 2016 -0700 ---------------------------------------------------------------------- .../main/scala/org/apache/spark/sql/SQLContext.scala | 12 ------------ .../main/scala/org/apache/spark/sql/SQLImplicits.scala | 11 +++++++++++ .../scala/org/apache/spark/sql/test/SQLTestUtils.scala | 7 ------- 3 files changed, 11 insertions(+), 19 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/spark/blob/b2b1ad7d/sql/core/src/main/scala/org/apache/spark/sql/SQLContext.scala ---------------------------------------------------------------------- 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 efaccec..c070e86 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 http://git-wip-us.apache.org/repos/asf/spark/blob/b2b1ad7d/sql/core/src/main/scala/org/apache/spark/sql/SQLImplicits.scala ---------------------------------------------------------------------- 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 fd814e0..4aab16b 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() http://git-wip-us.apache.org/repos/asf/spark/blob/b2b1ad7d/sql/core/src/test/scala/org/apache/spark/sql/test/SQLTestUtils.scala ---------------------------------------------------------------------- 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 926fabe..ab38767 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: _*)) - } - } } /** --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
