Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions core/src/main/scala/org/apache/spark/rdd/RDD.scala
Original file line number Diff line number Diff line change
Expand Up @@ -234,10 +234,10 @@ abstract class RDD[T: ClassTag](
* because DAGs are acyclic, and we only ever hold locks for one path in that DAG, there is no
* chance of deadlock.
*
* The use of Integer is simply so this is serializable -- executors may reference the shared
* fields (though they should never mutate them, that only happens on the driver).
* Executors may reference the shared fields (though they should never mutate them,
* that only happens on the driver).
*/
private val stateLock = new Integer(0)
private val stateLock = new Serializable {}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah anything Serializable is fine. Integer.valueOf(0) isn't ideal because it's going to be a shared object. Anything would work - String("") for example. This seems OK to just slightly odd looking. It could also be a proper Lock, used as a lock, but whatever.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@srowen Do you want me to modify this?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems OK to me as a minimal change that shouldn't matter for behavior.


// Our dependencies and partitions will be gotten by calling subclass's methods below, and will
// be overwritten when we're checkpointed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class MutableProjectionSuite extends SparkFunSuite with ExpressionEvalHelper {
val scalaValues = Seq("abc", BigDecimal(10),
IntervalUtils.stringToInterval(UTF8String.fromString("interval 1 day")),
Array[Byte](1, 2), Array("123", "456"), Map(1 -> "a", 2 -> "b"), Row(1, "a"),
new java.lang.Integer(5))
Integer.valueOf(5))
val inputRow = InternalRow.fromSeq(scalaValues.zip(variableLengthTypes).map {
case (v, dataType) => CatalystTypeConverters.createToCatalystConverter(dataType)(v)
})
Expand Down
4 changes: 2 additions & 2 deletions sql/core/src/test/scala/org/apache/spark/sql/UDFSuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -443,12 +443,12 @@ class UDFSuite extends QueryTest with SharedSparkSession {
test("SPARK-25044 Verify null input handling for primitive types - with udf(Any, DataType)") {
val f = udf((x: Int) => x, IntegerType)
checkAnswer(
Seq(new Integer(1), null).toDF("x").select(f($"x")),
Seq(Integer.valueOf(1), null).toDF("x").select(f($"x")),
Row(1) :: Row(0) :: Nil)

val f2 = udf((x: Double) => x, DoubleType)
checkAnswer(
Seq(new java.lang.Double(1.1), null).toDF("x").select(f2($"x")),
Seq(java.lang.Double.valueOf(1.1), null).toDF("x").select(f2($"x")),
Row(1.1) :: Row(0.0) :: Nil)

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,6 @@ class TestUDF extends GenericUDF {

override def evaluate(arguments: Array[GenericUDF.DeferredObject]): AnyRef = {
val point = data.getList(arguments(0).get())
new java.lang.Double(point.get(0).asInstanceOf[Double])
java.lang.Double.valueOf(point.get(0).asInstanceOf[Double])
}
}