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-12624][PYSPARK] Checks row length when converting Java arrays to Python rows #10886

Closed
wants to merge 2 commits into from

Conversation

liancheng
Copy link
Contributor

When actual row length doesn't conform to specified schema field length, we should give a better error message instead of throwing an unintuitive ArrayOutOfBoundsException.

assert(
array.length == fields.length,
s"Row length ${array.length} and schema length ${fields.length} don't match"
)
Copy link
Contributor

Choose a reason for hiding this comment

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

I am wondering if we should throw IllegalStateException because AssertionError can be disabled.

Also, regarding the error message, I wondering if something like The given row does not have the same number of values required by the schema. ${fields.length} values are expected. But, ${array.length} values are provided maybe a better one.

@SparkQA
Copy link

SparkQA commented Jan 24, 2016

Test build #49945 has finished for PR 10886 at commit ae0b55a.

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

@rxin
Copy link
Contributor

rxin commented Jan 25, 2016

cc @davies

@davies
Copy link
Contributor

davies commented Jan 25, 2016

LGTM

@SparkQA
Copy link

SparkQA commented Jan 25, 2016

Test build #49958 has finished for PR 10886 at commit ad8efa1.

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

@yhuai
Copy link
Contributor

yhuai commented Jan 25, 2016

Thanks! Merging to master and branch 1.6.

asfgit pushed a commit that referenced this pull request Jan 25, 2016
…to Python rows

When actual row length doesn't conform to specified schema field length, we should give a better error message instead of throwing an unintuitive `ArrayOutOfBoundsException`.

Author: Cheng Lian <lian@databricks.com>

Closes #10886 from liancheng/spark-12624.

(cherry picked from commit 3327fd2)
Signed-off-by: Yin Huai <yhuai@databricks.com>
@asfgit asfgit closed this in 3327fd2 Jan 25, 2016
@liancheng
Copy link
Contributor Author

Thanks for the review!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants