Github user viirya commented on a diff in the pull request:

    https://github.com/apache/spark/pull/10283#discussion_r48103300
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/GenericArrayData.scala
 ---
    @@ -18,14 +18,30 @@
     package org.apache.spark.sql.catalyst.util
     
     import scala.collection.JavaConverters._
    +import scala.collection.mutable.WrappedArray
     
     import org.apache.spark.sql.catalyst.InternalRow
     import org.apache.spark.sql.types.{DataType, Decimal}
     import org.apache.spark.unsafe.types.{CalendarInterval, UTF8String}
     
    +object GenericArrayData {
    +  def processSeq(seq: Seq[Any]): Array[Any] = {
    +    seq match {
    +      case wArray: WrappedArray[_] =>
    +        if (wArray.array == null) {
    +          null
    +        } else {
    +          wArray.toArray[Any]
    +        }
    +      case null => null
    +      case _ => seq.toArray
    +    }
    +  }
    +}
    +
     class GenericArrayData(val array: Array[Any]) extends ArrayData {
     
    -  def this(seq: Seq[Any]) = this(seq.toArray)
    +  def this(seq: Seq[Any]) = this(GenericArrayData.processSeq(seq))
    --- End diff --
    
    Thanks. I propose the fixing as pr #10401.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to