Skip to content
Snippets Groups Projects
Commit 1a598d71 authored by Sean Owen's avatar Sean Owen Committed by gatorsmile
Browse files

[SPARK-21837][SQL][TESTS] UserDefinedTypeSuite Local UDTs not actually testing what it intends

## What changes were proposed in this pull request?

Adjust Local UDTs test to assert about results, and fix index of vector column. See JIRA for details.

## How was this patch tested?

Existing tests.

Author: Sean Owen <sowen@cloudera.com>

Closes #19053 from srowen/SPARK-21837.
parent 51620e28
No related branches found
No related tags found
No related merge requests found
......@@ -203,12 +203,12 @@ class UserDefinedTypeSuite extends QueryTest with SharedSQLContext with ParquetT
// Tests to make sure that all operators correctly convert types on the way out.
test("Local UDTs") {
val df = Seq((1, new UDT.MyDenseVector(Array(0.1, 1.0)))).toDF("int", "vec")
df.collect()(0).getAs[UDT.MyDenseVector](1)
df.take(1)(0).getAs[UDT.MyDenseVector](1)
df.limit(1).groupBy('int).agg(first('vec)).collect()(0).getAs[UDT.MyDenseVector](0)
df.orderBy('int).limit(1).groupBy('int).agg(first('vec)).collect()(0)
.getAs[UDT.MyDenseVector](0)
val vec = new UDT.MyDenseVector(Array(0.1, 1.0))
val df = Seq((1, vec)).toDF("int", "vec")
assert(vec === df.collect()(0).getAs[UDT.MyDenseVector](1))
assert(vec === df.take(1)(0).getAs[UDT.MyDenseVector](1))
checkAnswer(df.limit(1).groupBy('int).agg(first('vec)), Row(1, vec))
checkAnswer(df.orderBy('int).limit(1).groupBy('int).agg(first('vec)), Row(1, vec))
}
test("UDTs with JSON") {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment