Skip to content

[SPARK-14000][SQL] case class with a tuple field can't work in Dataset #11816

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

Closed
wants to merge 2 commits into from

Conversation

cloud-fan
Copy link
Contributor

What changes were proposed in this pull request?

When we validate an encoder, we may call dataType on unresolved expressions. This PR fix the validation so that we will resolve attributes first.

How was this patch tested?

a new test in DatasetSuite

@cloud-fan
Copy link
Contributor Author

cc @rxin, this should fixes the failure in your #11737

@@ -110,7 +110,12 @@ case class GetStructField(child: Expression, ordinal: Int, name: Option[String]

override def dataType: DataType = childSchema(ordinal).dataType
override def nullable: Boolean = child.nullable || childSchema(ordinal).nullable
override def toString: String = s"$child.${name.getOrElse(childSchema(ordinal).name)}"

override def toString: String = {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

kind of unrelated change, toString should be able to run even this expression is unresolved.

@SparkQA
Copy link

SparkQA commented Mar 18, 2016

Test build #53519 has finished for PR 11816 at commit 9dc7a7e.

  • This patch fails Scala style tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@rxin
Copy link
Contributor

rxin commented Mar 18, 2016

thanks - looks good to me (but i don't know this code well enough).

@cloud-fan
Copy link
Contributor Author

cc @marmbrus

@SparkQA
Copy link

SparkQA commented Mar 18, 2016

Test build #53522 has finished for PR 11816 at commit a40a130.

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

@liancheng
Copy link
Contributor

LGTM, merging to master.

@asfgit asfgit closed this in 17a3f00 Mar 21, 2016
roygao94 pushed a commit to roygao94/spark that referenced this pull request Mar 22, 2016
## What changes were proposed in this pull request?

When we validate an encoder, we may call `dataType` on unresolved expressions. This PR fix the validation so that we will resolve attributes first.

## How was this patch tested?

a new test in `DatasetSuite`

Author: Wenchen Fan <wenchen@databricks.com>

Closes apache#11816 from cloud-fan/encoder.
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.

4 participants