From 80cb25b228e821a80256546a2f03f73a45cf7645 Mon Sep 17 00:00:00 2001 From: Michael Armbrust Date: Tue, 18 Aug 2015 13:50:51 -0700 Subject: [SPARK-10080] [SQL] Fix binary incompatibility for $ column interpolation Turns out that inner classes of inner objects are referenced directly, and thus moving it will break binary compatibility. Author: Michael Armbrust Closes #8281 from marmbrus/binaryCompat. --- .../src/main/scala/org/apache/spark/sql/SQLContext.scala | 11 +++++++++++ .../src/main/scala/org/apache/spark/sql/SQLImplicits.scala | 10 ---------- .../scala/org/apache/spark/sql/test/SharedSQLContext.scala | 12 +++++++++++- 3 files changed, 22 insertions(+), 11 deletions(-) (limited to 'sql') 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 53de10d5fa..58fe75b59f 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 @@ -334,6 +334,17 @@ class SQLContext(@transient val sparkContext: SparkContext) @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 5f82372700..47b6f80bed 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 @@ -33,16 +33,6 @@ import org.apache.spark.unsafe.types.UTF8String private[sql] abstract class SQLImplicits { protected def _sqlContext: SQLContext - /** - * Converts $"col name" into an [[Column]]. - * @since 1.3.0 - */ - implicit class StringToColumn(val sc: StringContext) { - def $(args: Any*): ColumnName = { - new ColumnName(sc.s(args: _*)) - } - } - /** * An implicit conversion that turns a Scala `Symbol` into a [[Column]]. * @since 1.3.0 diff --git a/sql/core/src/test/scala/org/apache/spark/sql/test/SharedSQLContext.scala b/sql/core/src/test/scala/org/apache/spark/sql/test/SharedSQLContext.scala index 3cfd822e2a..8a061b6bc6 100644 --- a/sql/core/src/test/scala/org/apache/spark/sql/test/SharedSQLContext.scala +++ b/sql/core/src/test/scala/org/apache/spark/sql/test/SharedSQLContext.scala @@ -17,7 +17,7 @@ package org.apache.spark.sql.test -import org.apache.spark.sql.SQLContext +import org.apache.spark.sql.{ColumnName, SQLContext} /** @@ -65,4 +65,14 @@ private[sql] trait SharedSQLContext extends SQLTestUtils { } } + /** + * Converts $"col name" into an [[Column]]. + * @since 1.3.0 + */ + // This must be duplicated 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