You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2020/10/29 10:59:46 UTC
[GitHub] [spark] MaxGekk opened a new pull request #30183: [SPARK-33286][SQL] Improve error message from `from_json`
MaxGekk opened a new pull request #30183:
URL: https://github.com/apache/spark/pull/30183
# What changes were proposed in this pull request?
In the PR, I propose to improve the error message from `from_json` by combining errors from all schema parsers:
- DataType.fromJson
- CatalystSqlParser.parseDataType
- CatalystSqlParser.parseTableSchema
Before the changes, `from_json` does not show error messages from the first parser in the chain that could mislead users.
### Why are the changes needed?
Currently, `from_json` outputs the error message from the fallback schema parser which can confuse end-users. For example:
```scala
val invalidJsonSchema = """{"fields": [{"a":123}], "type": "struct"}"""
df.select(from_json($"json", invalidJsonSchema, Map.empty[String, String])).show()
```
The JSON schema has an issue in `{"a":123}` but the error message doesn't point it out:
```
mismatched input '{' expecting {'ADD', 'AFTER', ...}(line 1, pos 0)
== SQL ==
{"fields": [{"a":123}], "type": "struct"}
^^^
org.apache.spark.sql.catalyst.parser.ParseException:
mismatched input '{' expecting {'ADD', 'AFTER', ... }(line 1, pos 0)
== SQL ==
{"fields": [{"a":123}], "type": "struct"}
^^^
```
### Does this PR introduce _any_ user-facing change?
Yes, after the changes for the example above:
```
Cannot parse the schema in JSON format: Failed to convert the JSON string '{"a":123}' to a field.
Failed fallback parsing: Cannot parse the data type:
mismatched input '{' expecting {'ADD', 'AFTER', ...}(line 1, pos 0)
== SQL ==
{"fields": [{"a":123}], "type": "struct"}
^^^
Failed fallback parsing:
mismatched input '{' expecting {'ADD', 'AFTER', ...}(line 1, pos 0)
== SQL ==
{"fields": [{"a":123}], "type": "struct"}
^^^
```
### How was this patch tested?
- By existing tests suites like `JsonFunctionsSuite` and `JsonExpressionsSuite`.
- Add new test to `JsonFunctionsSuite`.
- Re-gen results for `json-functions.sql`.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] HyukjinKwon commented on pull request #30183: [SPARK-33286][SQL] Improve the error message about schema parsing by `from_json/from_csv`
Posted by GitBox <gi...@apache.org>.
HyukjinKwon commented on pull request #30183:
URL: https://github.com/apache/spark/pull/30183#issuecomment-719129135
Merged to master.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins commented on pull request #30183: [SPARK-33286][SQL] Improve the error message about schema parsing by `from_json`
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #30183:
URL: https://github.com/apache/spark/pull/30183#issuecomment-718799336
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins commented on pull request #30183: [SPARK-33286][SQL] Improve the error message about schema parsing by `from_json/from_csv`
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #30183:
URL: https://github.com/apache/spark/pull/30183#issuecomment-718994611
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] HyukjinKwon closed pull request #30183: [SPARK-33286][SQL] Improve the error message about schema parsing by `from_json/from_csv`
Posted by GitBox <gi...@apache.org>.
HyukjinKwon closed pull request #30183:
URL: https://github.com/apache/spark/pull/30183
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins commented on pull request #30183: [SPARK-33286][SQL] Improve the error message about schema parsing by `from_json`
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #30183:
URL: https://github.com/apache/spark/pull/30183#issuecomment-718710520
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] SparkQA commented on pull request #30183: [SPARK-33286][SQL] Improve the error message about schema parsing by `from_json/from_csv`
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #30183:
URL: https://github.com/apache/spark/pull/30183#issuecomment-718853148
Kubernetes integration test starting
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/35017/
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] SparkQA commented on pull request #30183: [SPARK-33286][SQL] Improve the error message about schema parsing by `from_json`
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #30183:
URL: https://github.com/apache/spark/pull/30183#issuecomment-718667148
**[Test build #130405 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/130405/testReport)** for PR 30183 at commit [`72b9b57`](https://github.com/apache/spark/commit/72b9b5702b646ac9b4f9e84d0d55a369015eb008).
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins removed a comment on pull request #30183: [SPARK-33286][SQL] Improve the error message about schema parsing by `from_json`
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #30183:
URL: https://github.com/apache/spark/pull/30183#issuecomment-718799336
Merged build finished. Test FAILed.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] SparkQA removed a comment on pull request #30183: [SPARK-33286][SQL] Improve the error message about schema parsing by `from_json`
Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on pull request #30183:
URL: https://github.com/apache/spark/pull/30183#issuecomment-718667148
**[Test build #130405 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/130405/testReport)** for PR 30183 at commit [`72b9b57`](https://github.com/apache/spark/commit/72b9b5702b646ac9b4f9e84d0d55a369015eb008).
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins commented on pull request #30183: [SPARK-33286][SQL] Improve the error message about schema parsing by `from_json/from_csv`
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #30183:
URL: https://github.com/apache/spark/pull/30183#issuecomment-718869058
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] SparkQA commented on pull request #30183: [SPARK-33286][SQL] Improve the error message about schema parsing by `from_json`
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #30183:
URL: https://github.com/apache/spark/pull/30183#issuecomment-718697506
Kubernetes integration test starting
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/35009/
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] SparkQA commented on pull request #30183: [SPARK-33286][SQL] Improve the error message about schema parsing by `from_json/from_csv`
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #30183:
URL: https://github.com/apache/spark/pull/30183#issuecomment-718993382
**[Test build #130413 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/130413/testReport)** for PR 30183 at commit [`6fa7414`](https://github.com/apache/spark/commit/6fa741410796b4104c2bfa184ea8c3241b0589fb).
* This patch passes all tests.
* This patch merges cleanly.
* This patch adds no public classes.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] SparkQA commented on pull request #30183: [SPARK-33286][SQL] Improve the error message about schema parsing by `from_json`
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #30183:
URL: https://github.com/apache/spark/pull/30183#issuecomment-718798473
**[Test build #130405 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/130405/testReport)** for PR 30183 at commit [`72b9b57`](https://github.com/apache/spark/commit/72b9b5702b646ac9b4f9e84d0d55a369015eb008).
* This patch **fails Spark unit tests**.
* This patch merges cleanly.
* This patch adds no public classes.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins removed a comment on pull request #30183: [SPARK-33286][SQL] Improve the error message about schema parsing by `from_json/from_csv`
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #30183:
URL: https://github.com/apache/spark/pull/30183#issuecomment-718869068
Test FAILed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/35017/
Test FAILed.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] MaxGekk commented on pull request #30183: [SPARK-33286][SQL] Improve error message from `from_json`
Posted by GitBox <gi...@apache.org>.
MaxGekk commented on pull request #30183:
URL: https://github.com/apache/spark/pull/30183#issuecomment-718658231
@HyukjinKwon @cloud-fan Could you have a look at this PR, please.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] SparkQA removed a comment on pull request #30183: [SPARK-33286][SQL] Improve the error message about schema parsing by `from_json/from_csv`
Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on pull request #30183:
URL: https://github.com/apache/spark/pull/30183#issuecomment-718821880
**[Test build #130413 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/130413/testReport)** for PR 30183 at commit [`6fa7414`](https://github.com/apache/spark/commit/6fa741410796b4104c2bfa184ea8c3241b0589fb).
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] SparkQA commented on pull request #30183: [SPARK-33286][SQL] Improve the error message about schema parsing by `from_json`
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #30183:
URL: https://github.com/apache/spark/pull/30183#issuecomment-718710497
Kubernetes integration test status success
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/35009/
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] SparkQA commented on pull request #30183: [SPARK-33286][SQL] Improve the error message about schema parsing by `from_json`
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #30183:
URL: https://github.com/apache/spark/pull/30183#issuecomment-718821880
**[Test build #130413 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/130413/testReport)** for PR 30183 at commit [`6fa7414`](https://github.com/apache/spark/commit/6fa741410796b4104c2bfa184ea8c3241b0589fb).
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] SparkQA commented on pull request #30183: [SPARK-33286][SQL] Improve the error message about schema parsing by `from_json/from_csv`
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #30183:
URL: https://github.com/apache/spark/pull/30183#issuecomment-718869019
Kubernetes integration test status failure
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/35017/
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins removed a comment on pull request #30183: [SPARK-33286][SQL] Improve the error message about schema parsing by `from_json/from_csv`
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #30183:
URL: https://github.com/apache/spark/pull/30183#issuecomment-718994600
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins removed a comment on pull request #30183: [SPARK-33286][SQL] Improve the error message about schema parsing by `from_json`
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #30183:
URL: https://github.com/apache/spark/pull/30183#issuecomment-718799343
Test FAILed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/130405/
Test FAILed.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins removed a comment on pull request #30183: [SPARK-33286][SQL] Improve the error message about schema parsing by `from_json/from_csv`
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #30183:
URL: https://github.com/apache/spark/pull/30183#issuecomment-718869058
Merged build finished. Test FAILed.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins removed a comment on pull request #30183: [SPARK-33286][SQL] Improve the error message about schema parsing by `from_json`
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #30183:
URL: https://github.com/apache/spark/pull/30183#issuecomment-718710520
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org