You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "LuciferYang (via GitHub)" <gi...@apache.org> on 2023/11/03 00:29:26 UTC

[PR] [SPARK-45742][CORE][FOLLOWUP] Remove unnecessary null check from `ArrayImplicits.SparkArrayOps#toImmutableArraySeq` [spark]

LuciferYang opened a new pull request, #43641:
URL: https://github.com/apache/spark/pull/43641

   ### What changes were proposed in this pull request?
   The implementation of the `mmutable.ArraySeq.unsafeWrapArray` function is as follows:
   
   ```scala
     def unsafeWrapArray[T](x: Array[T]): ArraySeq[T] = ((x: @unchecked) match {
       case null              => null
       case x: Array[AnyRef]  => new ofRef[AnyRef](x)
       case x: Array[Int]     => new ofInt(x)
       case x: Array[Double]  => new ofDouble(x)
       case x: Array[Long]    => new ofLong(x)
       case x: Array[Float]   => new ofFloat(x)
       case x: Array[Char]    => new ofChar(x)
       case x: Array[Byte]    => new ofByte(x)
       case x: Array[Short]   => new ofShort(x)
       case x: Array[Boolean] => new ofBoolean(x)
       case x: Array[Unit]    => new ofUnit(x)
     }).asInstanceOf[ArraySeq[T]]
   ```
   
   The first case of match is null, there is no need to do another manual null check, so this PR removes it.
   
   
   ### Why are the changes needed?
   Remove unnecessary null check from `ArrayImplicits.SparkArrayOps#toImmutableArraySeq`
   
   
   ### Does this PR introduce _any_ user-facing change?
   No
   
   
   ### How was this patch tested?
   Existing test cases, such as `ArrayImplicitsSuite`.
   
   
   ### Was this patch authored or co-authored using generative AI tooling?
   No
   


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-45742][CORE][FOLLOWUP] Remove unnecessary null check from `ArrayImplicits.SparkArrayOps#toImmutableArraySeq` [spark]

Posted by "LuciferYang (via GitHub)" <gi...@apache.org>.
LuciferYang closed pull request #43641: [SPARK-45742][CORE][FOLLOWUP] Remove unnecessary null check from `ArrayImplicits.SparkArrayOps#toImmutableArraySeq`
URL: https://github.com/apache/spark/pull/43641


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-45742][CORE][FOLLOWUP] Remove unnecessary null check from `ArrayImplicits.SparkArrayOps#toImmutableArraySeq` [spark]

Posted by "LuciferYang (via GitHub)" <gi...@apache.org>.
LuciferYang commented on PR #43641:
URL: https://github.com/apache/spark/pull/43641#issuecomment-1792016994

   Merged into master for Spark 4.0. Thanks @dongjoon-hyun 


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org