Skip to content

Conversation

@cloud-fan
Copy link
Contributor

What changes were proposed in this pull request?

This PR improves the error handling of RowEncoder. When we create a RowEncoder with a given schema, we should validate the data type of input object. e.g. we should throw an exception when a field is boolean but is declared as a string column.

This PR also removes the support to use Product as a valid external type of struct type. This support is added at #9712, but is incomplete, e.g. nested product, product in array are both not working. However, we never officially support this feature and I think it's ok to ban it.

How was this patch tested?

new tests in RowEncoderSuite.

@cloud-fan
Copy link
Contributor Author

cc @marmbrus @yhuai @viirya

@SparkQA
Copy link

SparkQA commented May 31, 2016

Test build #59629 has finished for PR 13401 at commit b6c1a5f.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds the following public classes (experimental):
    • case class ValidateExternalType(child: Expression, expected: DataType)


val code = s"""
${input.code}
${ctx.javaType(dataType)} ${ev.value} = ${ctx.defaultValue(dataType)};
Copy link
Member

Choose a reason for hiding this comment

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

ctx.boxedType here too?

Copy link
Contributor Author

@cloud-fan cloud-fan May 31, 2016

Choose a reason for hiding this comment

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

This is intentional, we can't cast an object to int directly, but have to cast to boxed int first.

@SparkQA
Copy link

SparkQA commented Jun 3, 2016

Test build #59944 has finished for PR 13401 at commit 83fe3e0.

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

@SparkQA
Copy link

SparkQA commented Jun 3, 2016

Test build #59968 has finished for PR 13401 at commit f23891c.

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

@liancheng
Copy link
Contributor

LGTM, merging to master and branch-2.0.

asfgit pushed a commit that referenced this pull request Jun 5, 2016
…object

## What changes were proposed in this pull request?

This PR improves the error handling of `RowEncoder`. When we create a `RowEncoder` with a given schema, we should validate the data type of input object. e.g. we should throw an exception when a field is boolean but is declared as a string column.

This PR also removes the support to use `Product` as a valid external type of struct type.  This support is added at #9712, but is incomplete, e.g. nested product, product in array are both not working.  However, we never officially support this feature and I think it's ok to ban it.

## How was this patch tested?

new tests in `RowEncoderSuite`.

Author: Wenchen Fan <wenchen@databricks.com>

Closes #13401 from cloud-fan/bug.

(cherry picked from commit 30c4774)
Signed-off-by: Cheng Lian <lian@databricks.com>
@asfgit asfgit closed this in 30c4774 Jun 5, 2016
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