Skip to content

Commit

Permalink
fix flaky tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Davies Liu committed Oct 7, 2016
1 parent 566d7f2 commit 52b2b7d
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,14 +101,15 @@ class ColumnTypeSuite extends SparkFunSuite with Logging {

def testColumnType[JvmType](columnType: ColumnType[JvmType]): Unit = {

val buffer = ByteBuffer.allocate(DEFAULT_BUFFER_SIZE).order(ByteOrder.nativeOrder())
val proj = UnsafeProjection.create(Array[DataType](columnType.dataType))
val converter = CatalystTypeConverters.createToScalaConverter(columnType.dataType)
val seq = (0 until 4).map(_ => proj(makeRandomRow(columnType)).copy())
val totalSize = seq.map(_.getSizeInBytes).sum
val bufferSize = Math.max(DEFAULT_BUFFER_SIZE, totalSize)

test(s"$columnType append/extract") {
buffer.rewind()
seq.foreach(columnType.append(_, 0, buffer))
val buffer = ByteBuffer.allocate(bufferSize).order(ByteOrder.nativeOrder())
seq.foreach(r => columnType.append(columnType.getField(r, 0), buffer))

buffer.rewind()
seq.foreach { row =>
Expand Down

0 comments on commit 52b2b7d

Please sign in to comment.