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

    https://github.com/apache/spark/pull/20984#discussion_r181339660
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/ArrayData.scala 
---
    @@ -164,3 +167,46 @@ abstract class ArrayData extends SpecializedGetters 
with Serializable {
         }
       }
     }
    +
    +/**
    + * Implements an `IndexedSeq` interface for `ArrayData`. Notice that if 
the original `ArrayData`
    + * is a primitive array and contains null elements, it is better to ask 
for `IndexedSeq[Any]`,
    + * instead of `IndexedSeq[Int]`, in order to keep the null elements.
    + */
    +class ArrayDataIndexedSeq[T](arrayData: ArrayData, dataType: DataType) 
extends IndexedSeq[T] {
    +
    +  private def getAccessor(dataType: DataType): (Int) => Any = dataType 
match {
    +    case BooleanType => (idx: Int) => arrayData.getBoolean(idx)
    +    case ByteType => (idx: Int) => arrayData.getByte(idx)
    +    case ShortType => (idx: Int) => arrayData.getShort(idx)
    +    case IntegerType => (idx: Int) => arrayData.getInt(idx)
    --- End diff --
    
    I'd like to reuse the access getter in #20981 which covers `DateType` and 
`TimestampType`.


---

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

Reply via email to