-
Notifications
You must be signed in to change notification settings - Fork 29.1k
[SPARK-33270][SQL] Return SQL schema instead of Catalog string from the SchemaOfJson expression
#30172
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
Conversation
|
@HyukjinKwon @cloud-fan Could you take a look at this. |
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/jsonExpressions.scala
Show resolved
Hide resolved
|
+1 from me. |
|
Kubernetes integration test starting |
|
Kubernetes integration test status success |
|
Test build #130372 has finished for PR 30172 at commit
|
|
Kubernetes integration test starting |
|
This is fantastic! Thanks for the quick fix @MaxGekk |
|
Kubernetes integration test status success |
|
@MaxGekk -- can we back port this change to Spark 2.4? It doesn't seem like it would need any adaptations |
|
Kubernetes integration test starting |
|
Kubernetes integration test status success |
|
Test build #130377 has finished for PR 30172 at commit
|
|
Test build #130379 has finished for PR 30172 at commit
|
|
Merged to master. |
|
@HyukjinKwon @cloud-fan Here are similar changes for CSV: #30180 |
What changes were proposed in this pull request?
Return schema in SQL format instead of Catalog string from the
SchemaOfJsonexpression.Why are the changes needed?
In some cases,
from_json()cannot parse schemas returned byschema_of_json, for instance, when JSON fields have spaces (gaps). Such fields will be quoted after the changes, and can be parsed byfrom_json().Here is the example:
raises the exception:
Does this PR introduce any user-facing change?
Yes. For example,
schema_of_jsonfor the input{"col":0}.Before:
struct<col:bigint>After:
STRUCT<col: BIGINT>How was this patch tested?
By existing test suites
JsonFunctionsSuiteandJsonExpressionsSuite.