Commit f2079d8
[SPARK-52243][CONNECT] Add NERF support for schema-related InvalidPlanInput errors
### What changes were proposed in this pull request?
This PR adds NERF (New Error Framework) support for schema-related InvalidPlanInput errors in Spark Connect. The changes include:
1. Added a new error condition in error-conditions.json for schema validation:
- INVALID_SCHEMA_TYPE_NON_STRUCT
2. Refactored error handling in InvalidInputErrors.scala to use the new NERF framework:
- Added helper function invalidPlanInput for consistent error message generation
- Updated schema validation error methods to use NERF error conditions
- Made quoteByDefault method accessible to other packages
3. Added a test suite InvalidInputErrorsSuite.scala to verify error handling
### Why are the changes needed?
These changes are needed to:
1. Standardize error reporting across Spark Connect using the NERF framework
2. Improve error messages with better parameterization and consistency
3. Ensure proper SQL state codes are associated with schema-related errors
4. Provide clearer error messages for users when schema validation fails
### Does this PR introduce _any_ user-facing change?
No
### How was this patch tested?
`build/sbt "connect/testOnly *InvalidInputErrorsSuite"`
### Was this patch authored or co-authored using generative AI tooling?
Generated-by: Cursor 0.50.5 (Universal)
Closes apache#50997 from heyihong/SPARK-52243.
Authored-by: Yihong He <heyihong.cn@gmail.com>
Signed-off-by: Wenchen Fan <wenchen@databricks.com>1 parent f423885 commit f2079d8
6 files changed
Lines changed: 148 additions & 32 deletions
File tree
- common/utils/src/main/resources/error
- python/pyspark/sql/tests/connect
- sql
- api/src/main/scala/org/apache/spark/sql/errors
- connect/server/src
- main/scala/org/apache/spark/sql/connect/planner
- test/scala/org/apache/spark/sql/connect/planner
Lines changed: 6 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3432 | 3432 | | |
3433 | 3433 | | |
3434 | 3434 | | |
| 3435 | + | |
| 3436 | + | |
| 3437 | + | |
| 3438 | + | |
| 3439 | + | |
| 3440 | + | |
3435 | 3441 | | |
3436 | 3442 | | |
3437 | 3443 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
64 | | - | |
| 64 | + | |
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
85 | 85 | | |
86 | 86 | | |
87 | 87 | | |
88 | | - | |
| 88 | + | |
89 | 89 | | |
90 | 90 | | |
91 | 91 | | |
| |||
Lines changed: 16 additions & 23 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
22 | 23 | | |
23 | 24 | | |
| 25 | + | |
24 | 26 | | |
25 | 27 | | |
26 | 28 | | |
27 | 29 | | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
28 | 38 | | |
29 | 39 | | |
30 | 40 | | |
| |||
72 | 82 | | |
73 | 83 | | |
74 | 84 | | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | 85 | | |
81 | 86 | | |
82 | 87 | | |
| |||
91 | 96 | | |
92 | 97 | | |
93 | 98 | | |
94 | | - | |
95 | | - | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
96 | 103 | | |
97 | 104 | | |
98 | 105 | | |
| |||
106 | 113 | | |
107 | 114 | | |
108 | 115 | | |
109 | | - | |
110 | | - | |
| 116 | + | |
| 117 | + | |
111 | 118 | | |
112 | 119 | | |
113 | 120 | | |
| |||
189 | 196 | | |
190 | 197 | | |
191 | 198 | | |
192 | | - | |
193 | | - | |
194 | | - | |
195 | 199 | | |
196 | 200 | | |
197 | 201 | | |
| |||
213 | 217 | | |
214 | 218 | | |
215 | 219 | | |
216 | | - | |
217 | | - | |
218 | | - | |
219 | | - | |
220 | | - | |
221 | | - | |
222 | | - | |
223 | | - | |
224 | | - | |
225 | | - | |
226 | | - | |
227 | 220 | | |
228 | 221 | | |
229 | 222 | | |
Lines changed: 5 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
773 | 773 | | |
774 | 774 | | |
775 | 775 | | |
776 | | - | |
| 776 | + | |
777 | 777 | | |
778 | 778 | | |
779 | 779 | | |
| |||
1105 | 1105 | | |
1106 | 1106 | | |
1107 | 1107 | | |
1108 | | - | |
1109 | | - | |
| 1108 | + | |
1110 | 1109 | | |
1111 | 1110 | | |
1112 | 1111 | | |
| |||
1502 | 1501 | | |
1503 | 1502 | | |
1504 | 1503 | | |
1505 | | - | |
| 1504 | + | |
1506 | 1505 | | |
1507 | 1506 | | |
1508 | 1507 | | |
| |||
1580 | 1579 | | |
1581 | 1580 | | |
1582 | 1581 | | |
1583 | | - | |
| 1582 | + | |
1584 | 1583 | | |
1585 | 1584 | | |
1586 | 1585 | | |
| |||
2967 | 2966 | | |
2968 | 2967 | | |
2969 | 2968 | | |
2970 | | - | |
2971 | | - | |
| 2969 | + | |
2972 | 2970 | | |
2973 | 2971 | | |
2974 | 2972 | | |
| |||
Lines changed: 119 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
0 commit comments