Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
wants to merge 2 commits into from

Conversation

srowen
Copy link
Member

@srowen srowen commented Aug 25, 2017

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.

srowen referenced this pull request Aug 25, 2017
## What changes were proposed in this pull request?

Enable ScalaReflection and User Defined Types for plain Scala classes.

This involves the move of `schemaFor` from `ScalaReflection` trait (which is Runtime and Compile time (macros) reflection) to the `ScalaReflection` object (runtime reflection only) as I believe this code wouldn't work at compile time anyway as it manipulates `Class`'s that are not compiled yet.

## How was this patch tested?

Unit test

Author: Joan <joan@goyeau.com>

Closes #12149 from joan38/SPARK-13929-Scala-reflection.
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))
assert(vec === df.limit(1).groupBy('int).agg(first('vec)).collect()(0)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that this and the next line fails with the assert added, if it is left dereferencing col 0 at the end instead of 1.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the last two lines are not testing collect, we can rewrite them to

    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))

@SparkQA
Copy link

SparkQA commented Aug 25, 2017

Test build #81130 has finished for PR 19053 at commit f502f4f.

  • This patch fails SparkR unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@gatorsmile
Copy link
Member

UDF?

@srowen
Copy link
Member Author

srowen commented Aug 25, 2017

Oops, I meant UDT. Just referring to the tests name in the code.

@srowen srowen changed the title [SPARK-21837][SQL][TESTS] UserDefinedTypeSuite local UDFs not actually testing what it intends [SPARK-21837][SQL][TESTS] UserDefinedTypeSuite Local UDTs not actually testing what it intends Aug 25, 2017
@gatorsmile
Copy link
Member

LGTM except one comment.

@SparkQA
Copy link

SparkQA commented Aug 25, 2017

Test build #3903 has finished for PR 19053 at commit f502f4f.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@gatorsmile
Copy link
Member

LGTM

@SparkQA
Copy link

SparkQA commented Aug 25, 2017

Test build #81137 has finished for PR 19053 at commit a80c79a.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@gatorsmile
Copy link
Member

Thanks! Merging to master.

@asfgit asfgit closed this in 1a598d7 Aug 25, 2017
@srowen srowen deleted the SPARK-21837 branch August 25, 2017 20:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants