Skip to content

Commit

Permalink
Add a test.
Browse files Browse the repository at this point in the history
  • Loading branch information
viirya committed Feb 28, 2016
1 parent 44f5c41 commit 1b09304
Showing 1 changed file with 33 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -175,4 +175,37 @@ class ParquetHadoopFsRelationSuite extends HadoopFsRelationTest {
}
}
}

test(s"SPARK-13537: Fix readBytes in VectorizedPlainValuesReader") {
withTempPath { file =>
val path = file.getCanonicalPath

val schema = new StructType()
.add("index", IntegerType, nullable = false)
.add("col", ByteType, nullable = true)

val data = Seq(Row(1, -33.toByte), Row(2, 0.toByte), Row(3, -55.toByte), Row(4, 56.toByte),
Row(5, 127.toByte), Row(6, -44.toByte), Row(7, 23.toByte), Row(8, -95.toByte),
Row(9, 127.toByte), Row(10, 13.toByte))

val rdd = sqlContext.sparkContext.parallelize(data)
val df = sqlContext.createDataFrame(rdd, schema).orderBy("index").coalesce(1)

df.write
.mode("overwrite")
.format(dataSourceName)
.option("dataSchema", df.schema.json)
.save(path)

val loadedDF = sqlContext
.read
.format(dataSourceName)
.option("dataSchema", df.schema.json)
.schema(df.schema)
.load(path)
.orderBy("index")

checkAnswer(loadedDF, df)
}
}
}

0 comments on commit 1b09304

Please sign in to comment.