diff options
author | Michael Armbrust <michael@databricks.com> | 2015-08-18 13:50:51 -0700 |
---|---|---|
committer | Michael Armbrust <michael@databricks.com> | 2015-08-18 13:50:51 -0700 |
commit | 80cb25b228e821a80256546a2f03f73a45cf7645 (patch) | |
tree | 758d14f78816194b80b036c0e0afd7d705fb3fe8 | |
parent | bf1d6614dcb8f5974e62e406d9c0f8aac52556d3 (diff) | |
download | spark-80cb25b228e821a80256546a2f03f73a45cf7645.tar.gz spark-80cb25b228e821a80256546a2f03f73a45cf7645.tar.bz2 spark-80cb25b228e821a80256546a2f03f73a45cf7645.zip |
[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 <michael@databricks.com>
Closes #8281 from marmbrus/binaryCompat.
3 files changed, 22 insertions, 11 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 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 @@ -34,16 +34,6 @@ 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: _*)) + } + } } |