Skip to content

Commit

Permalink
Makes ColumnAccessor.extractSingle row based
Browse files Browse the repository at this point in the history
  • Loading branch information
liancheng committed Sep 10, 2014
1 parent 8216936 commit edac3cd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,12 @@ private[sql] abstract class BasicColumnAccessor[T <: DataType, JvmType](
def hasNext = buffer.hasRemaining

def extractTo(row: MutableRow, ordinal: Int) {
columnType.setField(row, ordinal, extractSingle(buffer))
extractSingle(row, ordinal)
}

def extractSingle(buffer: ByteBuffer): JvmType = columnType.extract(buffer)
def extractSingle(row: MutableRow, ordinal: Int) {
columnType.setField(row, ordinal, columnType.extract(buffer))
}

protected def underlyingBuffer = buffer
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@

package org.apache.spark.sql.columnar.compression

import java.nio.ByteBuffer

import org.apache.spark.sql.catalyst.expressions.MutableRow
import org.apache.spark.sql.catalyst.types.NativeType
import org.apache.spark.sql.columnar.{ColumnAccessor, NativeColumnAccessor}

Expand All @@ -34,5 +33,7 @@ private[sql] trait CompressibleColumnAccessor[T <: NativeType] extends ColumnAcc

abstract override def hasNext = super.hasNext || decoder.hasNext

override def extractSingle(buffer: ByteBuffer): T#JvmType = decoder.next()
override def extractSingle(row: MutableRow, ordinal: Int) {
columnType.setField(row, ordinal, decoder.next())
}
}

0 comments on commit edac3cd

Please sign in to comment.