spark-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dongjoon-hyun <...@git.apache.org>
Subject [GitHub] spark pull request #20984: [SPARK-23875][SQL] Add IndexedSeq wrapper for Arr...
Date Thu, 12 Apr 2018 16:18:11 GMT
Github user dongjoon-hyun commented on a diff in the pull request:

    https://github.com/apache/spark/pull/20984#discussion_r181140698
  
    --- 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 --
    
    `DateType` and `TimestampType`? 


---

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


Mime
View raw message