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-13953][SQL] Specifying the field name for corrupted record via option at JSON datasource #11881

Closed
wants to merge 3 commits into from

Conversation

HyukjinKwon
Copy link
Member

What changes were proposed in this pull request?

https://issues.apache.org/jira/browse/SPARK-13953

Currently, JSON data source creates a new field in PERMISSIVE mode for storing malformed string.
This field can be renamed via spark.sql.columnNameOfCorruptRecord option but it is a global configuration.

This PR make that option can be applied per read and can be specified via option(). This will overwrites spark.sql.columnNameOfCorruptRecord if it is set.

How was this patch tested?

Unit tests were used and ./dev/run_tests for coding style tests.

@HyukjinKwon
Copy link
Member Author

cc @cloud-fan @rxin

``null`` for extra fields.
* ``DROPMALFORMED`` : ignores the whole corrupted records.
* ``FAILFAST`` : throws an exception when it meets corrupted records.
* ``columnNameOfCorruptRecord`` (default ``_corrupt_record``): allows renaming the \
new field having malformed string created by ``PERMISSIVE`` mode. \
This overwrites ``spark.sql.columnNameOfCorruptRecord``.
Copy link
Contributor

Choose a reason for hiding this comment

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

overrides?

@cloud-fan
Copy link
Contributor

LGTM, pending tests

@SparkQA
Copy link

SparkQA commented Mar 22, 2016

Test build #53756 has finished for PR 11881 at commit e274b5d.

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

@SparkQA
Copy link

SparkQA commented Mar 22, 2016

Test build #53758 has finished for PR 11881 at commit 73a8913.

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

@cloud-fan
Copy link
Contributor

thanks, merging to master.

@asfgit asfgit closed this in 4e09a0d Mar 22, 2016
roygao94 pushed a commit to roygao94/spark that referenced this pull request Mar 22, 2016
… option at JSON datasource

## What changes were proposed in this pull request?

https://issues.apache.org/jira/browse/SPARK-13953

Currently, JSON data source creates a new field in `PERMISSIVE` mode for storing malformed string.
This field can be renamed via `spark.sql.columnNameOfCorruptRecord` option but it is a global configuration.

This PR make that option can be applied per read and can be specified via `option()`. This will overwrites `spark.sql.columnNameOfCorruptRecord` if it is set.

## How was this patch tested?

Unit tests were used and `./dev/run_tests` for coding style tests.

Author: hyukjinkwon <[email protected]>

Closes apache#11881 from HyukjinKwon/SPARK-13953.
HyukjinKwon added a commit to databricks/spark-xml that referenced this pull request Sep 10, 2016
#105

Currently, this library does not support `PERMISSIVE` parse mode. Similar with JSON data source, this also can be done in the same way with `_corrupt_record`.

This PR adds the support for `PERMISSIVE` mode and make this behaviour consistent with the other data sources supporting parse modes (JSON and CSV data sources.)

Also, this PR adds the support for `_corrupt_record`.

This PR is similar with apache/spark#11756 and apache/spark#11881.

Author: hyukjinkwon <[email protected]>

Closes #107 from HyukjinKwon/ISSUE-105-permissive.
@HyukjinKwon HyukjinKwon deleted the SPARK-13953 branch January 2, 2018 03:40
beluisterql added a commit to beluisterql/spark-xml that referenced this pull request Aug 4, 2024
databricks/spark-xml#105

Currently, this library does not support `PERMISSIVE` parse mode. Similar with JSON data source, this also can be done in the same way with `_corrupt_record`.

This PR adds the support for `PERMISSIVE` mode and make this behaviour consistent with the other data sources supporting parse modes (JSON and CSV data sources.)

Also, this PR adds the support for `_corrupt_record`.

This PR is similar with apache/spark#11756 and apache/spark#11881.

Author: hyukjinkwon <[email protected]>

Closes #107 from HyukjinKwon/ISSUE-105-permissive.
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