aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorReynold Xin <rxin@databricks.com>2016-03-22 13:48:03 -0700
committerReynold Xin <rxin@databricks.com>2016-03-22 13:48:03 -0700
commitb2b1ad7d4cc3b3469c3d2c841b40b58ed0e34447 (patch)
tree01f73adf332fde8844a56bef82c299fab7f54c5e
parent7e3423b9c03c9812d404134c3d204c4cfea87721 (diff)
downloadspark-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.
-rw-r--r--sql/core/src/main/scala/org/apache/spark/sql/SQLContext.scala12
-rw-r--r--sql/core/src/main/scala/org/apache/spark/sql/SQLImplicits.scala11
-rw-r--r--sql/core/src/test/scala/org/apache/spark/sql/test/SQLTestUtils.scala7
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: _*))
- }
- }
}
/**