Commit efa824a
[SPARK-24709][SQL][FOLLOW-UP] Make schema_of_json's input json as literal only
## What changes were proposed in this pull request?
The main purpose of `schema_of_json` is the usage of combination with `from_json` (to make up the leak of schema inference) which takes its schema only as literal; however, currently `schema_of_json` allows JSON input as non-literal expressions (e.g, column).
This was mistakenly allowed - we don't have to take other usages rather then the main purpose into account for now.
This PR makes a followup to only allow literals for `schema_of_json`'s JSON input. We can allow non literal expressions later when it's needed or there are some usecase for it.
## How was this patch tested?
Unit tests were added.
Closes apache#22775 from HyukjinKwon/SPARK-25447-followup.
Lead-authored-by: hyukjinkwon <gurwls223@apache.org>
Co-authored-by: Hyukjin Kwon <gurwls223@apache.org>
Signed-off-by: Wenchen Fan <wenchen@databricks.com>1 parent 5392fe5 commit efa824a
File tree
6 files changed
+87
-24
lines changed- python/pyspark/sql
- sql
- catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions
- core/src
- main/scala/org/apache/spark/sql
- test
- resources/sql-tests
- inputs
- results
- scala/org/apache/spark/sql
6 files changed
+87
-24
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2335 | 2335 | | |
2336 | 2336 | | |
2337 | 2337 | | |
2338 | | - | |
| 2338 | + | |
2339 | 2339 | | |
2340 | | - | |
| 2340 | + | |
2341 | 2341 | | |
2342 | | - | |
| 2342 | + | |
2343 | 2343 | | |
2344 | 2344 | | |
2345 | 2345 | | |
2346 | 2346 | | |
2347 | 2347 | | |
2348 | | - | |
2349 | | - | |
2350 | | - | |
2351 | | - | |
2352 | | - | |
| 2348 | + | |
2353 | 2349 | | |
2354 | 2350 | | |
2355 | | - | |
| 2351 | + | |
2356 | 2352 | | |
2357 | 2353 | | |
2358 | 2354 | | |
| 2355 | + | |
| 2356 | + | |
| 2357 | + | |
| 2358 | + | |
| 2359 | + | |
| 2360 | + | |
2359 | 2361 | | |
2360 | 2362 | | |
2361 | | - | |
| 2363 | + | |
2362 | 2364 | | |
2363 | 2365 | | |
2364 | 2366 | | |
| |||
Lines changed: 17 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
742 | 742 | | |
743 | 743 | | |
744 | 744 | | |
745 | | - | |
| 745 | + | |
746 | 746 | | |
747 | 747 | | |
748 | 748 | | |
749 | 749 | | |
750 | 750 | | |
751 | 751 | | |
752 | 752 | | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
753 | 757 | | |
754 | 758 | | |
755 | 759 | | |
| |||
760 | 764 | | |
761 | 765 | | |
762 | 766 | | |
763 | | - | |
764 | | - | |
| 767 | + | |
| 768 | + | |
| 769 | + | |
| 770 | + | |
| 771 | + | |
| 772 | + | |
| 773 | + | |
| 774 | + | |
| 775 | + | |
| 776 | + | |
| 777 | + | |
765 | 778 | | |
766 | 779 | | |
767 | 780 | | |
| |||
776 | 789 | | |
777 | 790 | | |
778 | 791 | | |
779 | | - | |
| 792 | + | |
780 | 793 | | |
781 | 794 | | |
782 | 795 | | |
| |||
Lines changed: 17 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3626 | 3626 | | |
3627 | 3627 | | |
3628 | 3628 | | |
3629 | | - | |
| 3629 | + | |
3630 | 3630 | | |
3631 | | - | |
| 3631 | + | |
3632 | 3632 | | |
3633 | 3633 | | |
3634 | 3634 | | |
3635 | 3635 | | |
3636 | | - | |
| 3636 | + | |
3637 | 3637 | | |
3638 | 3638 | | |
3639 | | - | |
| 3639 | + | |
3640 | 3640 | | |
3641 | | - | |
| 3641 | + | |
| 3642 | + | |
| 3643 | + | |
| 3644 | + | |
| 3645 | + | |
| 3646 | + | |
| 3647 | + | |
| 3648 | + | |
| 3649 | + | |
| 3650 | + | |
| 3651 | + | |
3642 | 3652 | | |
3643 | 3653 | | |
3644 | 3654 | | |
3645 | 3655 | | |
3646 | 3656 | | |
3647 | 3657 | | |
3648 | 3658 | | |
3649 | | - | |
3650 | | - | |
| 3659 | + | |
| 3660 | + | |
3651 | 3661 | | |
3652 | 3662 | | |
3653 | 3663 | | |
| |||
Lines changed: 5 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
58 | | - | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
Lines changed: 35 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| |||
318 | 318 | | |
319 | 319 | | |
320 | 320 | | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
395 | 395 | | |
396 | 396 | | |
397 | 397 | | |
398 | | - | |
| 398 | + | |
399 | 399 | | |
400 | 400 | | |
401 | 401 | | |
| |||
0 commit comments