diff options
author | Reynold Xin <rxin@databricks.com> | 2016-03-22 13:48:03 -0700 |
---|---|---|
committer | Reynold Xin <rxin@databricks.com> | 2016-03-22 13:48:03 -0700 |
commit | b2b1ad7d4cc3b3469c3d2c841b40b58ed0e34447 (patch) | |
tree | 01f73adf332fde8844a56bef82c299fab7f54c5e /sql/core/src/main | |
parent | 7e3423b9c03c9812d404134c3d204c4cfea87721 (diff) | |
download | spark-b2b1ad7d4cc3b3469c3d2c841b40b58ed0e34447.tar.gz spark-b2b1ad7d4cc3b3469c3d2c841b40b58ed0e34447.tar.bz2 spark-b2b1ad7d4cc3b3469c3d2c841b40b58ed0e34447.zip |
[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.
Diffstat (limited to 'sql/core/src/main')
-rw-r--r-- | sql/core/src/main/scala/org/apache/spark/sql/SQLContext.scala | 12 | ||||
-rw-r--r-- | sql/core/src/main/scala/org/apache/spark/sql/SQLImplicits.scala | 11 |
2 files changed, 11 insertions, 12 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() |