Repository: spark Updated Branches: refs/heads/master b9bab4dcf -> e3cd5b305
[SPARK-16634][SQL] Workaround JVM bug by moving some code out of ctor. Some 1.7 JVMs have a bug that is triggered by certain Scala-generated bytecode. GenericArrayData suffers from that and fails to load in certain JVMs. Moving the offending code out of the constructor and into a helper method avoids the issue. Author: Marcelo Vanzin <van...@cloudera.com> Closes #14271 from vanzin/SPARK-16634. Project: http://git-wip-us.apache.org/repos/asf/spark/repo Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/e3cd5b30 Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/e3cd5b30 Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/e3cd5b30 Branch: refs/heads/master Commit: e3cd5b3050711af69fc1dfc518b11bf1a86b6a4c Parents: b9bab4d Author: Marcelo Vanzin <van...@cloudera.com> Authored: Wed Jul 20 10:38:44 2016 -0700 Committer: Marcelo Vanzin <van...@cloudera.com> Committed: Wed Jul 20 10:38:44 2016 -0700 ---------------------------------------------------------------------- .../spark/sql/catalyst/util/GenericArrayData.scala | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/spark/blob/e3cd5b30/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/GenericArrayData.scala ---------------------------------------------------------------------- diff --git a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/GenericArrayData.scala b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/GenericArrayData.scala index 3a665d3..7ee9581 100644 --- a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/GenericArrayData.scala +++ b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/GenericArrayData.scala @@ -23,6 +23,16 @@ import org.apache.spark.sql.catalyst.InternalRow import org.apache.spark.sql.types.{DataType, Decimal} import org.apache.spark.unsafe.types.{CalendarInterval, UTF8String} +private object GenericArrayData { + + // SPARK-16634: Workaround for JVM bug present in some 1.7 versions. + def anyToSeq(seqOrArray: Any): Seq[Any] = seqOrArray match { + case seq: Seq[Any] => seq + case array: Array[_] => array.toSeq + } + +} + class GenericArrayData(val array: Array[Any]) extends ArrayData { def this(seq: Seq[Any]) = this(seq.toArray) @@ -37,10 +47,7 @@ class GenericArrayData(val array: Array[Any]) extends ArrayData { def this(primitiveArray: Array[Byte]) = this(primitiveArray.toSeq) def this(primitiveArray: Array[Boolean]) = this(primitiveArray.toSeq) - def this(seqOrArray: Any) = this(seqOrArray match { - case seq: Seq[Any] => seq - case array: Array[_] => array.toSeq - }) + def this(seqOrArray: Any) = this(GenericArrayData.anyToSeq(seqOrArray)) override def copy(): ArrayData = new GenericArrayData(array.clone()) --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@spark.apache.org For additional commands, e-mail: commits-h...@spark.apache.org