Skip to content
Snippets Groups Projects
Commit 80cb25b2 authored by Michael Armbrust's avatar Michael Armbrust
Browse files

[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.
parent bf1d6614
No related branches found
No related tags found
No related merge requests found
...@@ -334,6 +334,17 @@ class SQLContext(@transient val sparkContext: SparkContext) ...@@ -334,6 +334,17 @@ class SQLContext(@transient val sparkContext: SparkContext)
@Experimental @Experimental
object implicits extends SQLImplicits with Serializable { object implicits extends SQLImplicits with Serializable {
protected override def _sqlContext: SQLContext = self 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 // scalastyle:on
......
...@@ -33,16 +33,6 @@ import org.apache.spark.unsafe.types.UTF8String ...@@ -33,16 +33,6 @@ import org.apache.spark.unsafe.types.UTF8String
private[sql] abstract class SQLImplicits { private[sql] abstract class SQLImplicits {
protected def _sqlContext: SQLContext 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]]. * An implicit conversion that turns a Scala `Symbol` into a [[Column]].
* @since 1.3.0 * @since 1.3.0
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
package org.apache.spark.sql.test 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 { ...@@ -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: _*))
}
}
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment