LuciferYang commented on code in PR #46811:
URL: https://github.com/apache/spark/pull/46811#discussion_r1623723019
##########
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/FileWriterFactory.scala:
##########
@@ -38,7 +38,7 @@ case class FileWriterFactory (
@transient private lazy val jobId =
SparkHadoopWriterUtils.createJobID(jobTrackerID, 0)
override def createWriter(partitionId: Int, realTaskId: Long):
DataWriter[InternalRow] = {
- val taskAttemptContext = createTaskAttemptContext(partitionId)
+ val taskAttemptContext = createTaskAttemptContext(partitionId,
realTaskId.toInt & Int.MaxValue)
Review Comment:
@cloud-fan If overflow `realTaskId.toInt & Int.MaxValue` and `math.abs` are
not equal:
```scala
scala> val realTaskId = Long.MaxValue
val realTaskId: Long = 9223372036854775807
scala> val a = realTaskId.toInt
val a: Int = -1
scala> val b = realTaskId.toInt & Int.MaxValue
val b: Int = 2147483647
scala> val c= math.abs(realTaskId.toInt)
val c: Int = 1
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]