Commit 9389c6b
[SPARK-46820][PYTHON] Fix error message regression by restoring
### What changes were proposed in this pull request?
This PR proposes to fix error message regression by restoring `new_msg`.
### Why are the changes needed?
In the past few PRs, we mistakenly remove `new_msg` which introduces error message regression.
### Does this PR introduce _any_ user-facing change?
No API change, but the user-facing error message is improved
**Before**
```python
>>> from pyspark.sql.types import StructType, StructField, StringType, IntegerType
>>> schema = StructType([
... StructField("name", StringType(), nullable=True),
... StructField("age", IntegerType(), nullable=False)
... ])
>>> df = spark.createDataFrame([(["asd", None])], schema)
pyspark.errors.exceptions.base.PySparkValueError: [CANNOT_BE_NONE] Argument `obj` cannot be None.
```
**After**
```python
>>> from pyspark.sql.types import StructType, StructField, StringType, IntegerType
>>> schema = StructType([
... StructField("name", StringType(), nullable=True),
... StructField("age", IntegerType(), nullable=False)
... ])
>>> df = spark.createDataFrame([(["asd", None])], schema)
pyspark.errors.exceptions.base.PySparkValueError: field age: This field is not nullable, but got None
```
### How was this patch tested?
The existing CI should pass
### Was this patch authored or co-authored using generative AI tooling?
No.
Closes #44859 from itholic/SPARK-46820.
Authored-by: Haejoon Lee <haejoon.lee@databricks.com>
Signed-off-by: Hyukjin Kwon <gurwls223@apache.org>new_msg
1 parent aa53c8e commit 9389c6b
File tree
4 files changed
+108
-29
lines changed- python/pyspark
- errors
- sql
- tests
4 files changed
+108
-29
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
286 | 286 | | |
287 | 287 | | |
288 | 288 | | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
289 | 329 | | |
290 | 330 | | |
291 | 331 | | |
| |||
612 | 652 | | |
613 | 653 | | |
614 | 654 | | |
615 | | - | |
616 | | - | |
617 | | - | |
618 | | - | |
619 | | - | |
620 | 655 | | |
621 | 656 | | |
622 | 657 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1271 | 1271 | | |
1272 | 1272 | | |
1273 | 1273 | | |
1274 | | - | |
| 1274 | + | |
1275 | 1275 | | |
1276 | 1276 | | |
1277 | 1277 | | |
1278 | 1278 | | |
1279 | 1279 | | |
1280 | | - | |
| 1280 | + | |
1281 | 1281 | | |
1282 | 1282 | | |
1283 | 1283 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1458 | 1458 | | |
1459 | 1459 | | |
1460 | 1460 | | |
1461 | | - | |
| 1461 | + | |
1462 | 1462 | | |
1463 | | - | |
| 1463 | + | |
1464 | 1464 | | |
1465 | 1465 | | |
1466 | 1466 | | |
| |||
1470 | 1470 | | |
1471 | 1471 | | |
1472 | 1472 | | |
1473 | | - | |
| 1473 | + | |
1474 | 1474 | | |
1475 | 1475 | | |
1476 | | - | |
1477 | | - | |
| 1476 | + | |
| 1477 | + | |
| 1478 | + | |
1478 | 1479 | | |
1479 | 1480 | | |
1480 | 1481 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2196 | 2196 | | |
2197 | 2197 | | |
2198 | 2198 | | |
| 2199 | + | |
| 2200 | + | |
| 2201 | + | |
| 2202 | + | |
| 2203 | + | |
| 2204 | + | |
| 2205 | + | |
2199 | 2206 | | |
2200 | | - | |
2201 | | - | |
| 2207 | + | |
| 2208 | + | |
2202 | 2209 | | |
2203 | 2210 | | |
2204 | 2211 | | |
| |||
2213 | 2220 | | |
2214 | 2221 | | |
2215 | 2222 | | |
| 2223 | + | |
| 2224 | + | |
| 2225 | + | |
| 2226 | + | |
| 2227 | + | |
| 2228 | + | |
| 2229 | + | |
| 2230 | + | |
| 2231 | + | |
| 2232 | + | |
2216 | 2233 | | |
2217 | | - | |
| 2234 | + | |
2218 | 2235 | | |
2219 | 2236 | | |
2220 | | - | |
2221 | | - | |
| 2237 | + | |
| 2238 | + | |
2222 | 2239 | | |
2223 | 2240 | | |
2224 | 2241 | | |
| |||
2232 | 2249 | | |
2233 | 2250 | | |
2234 | 2251 | | |
| 2252 | + | |
| 2253 | + | |
| 2254 | + | |
| 2255 | + | |
| 2256 | + | |
| 2257 | + | |
| 2258 | + | |
| 2259 | + | |
| 2260 | + | |
2235 | 2261 | | |
2236 | | - | |
| 2262 | + | |
2237 | 2263 | | |
2238 | | - | |
2239 | | - | |
| 2264 | + | |
| 2265 | + | |
2240 | 2266 | | |
2241 | 2267 | | |
2242 | 2268 | | |
| |||
2365 | 2391 | | |
2366 | 2392 | | |
2367 | 2393 | | |
| 2394 | + | |
| 2395 | + | |
| 2396 | + | |
| 2397 | + | |
| 2398 | + | |
| 2399 | + | |
| 2400 | + | |
| 2401 | + | |
| 2402 | + | |
2368 | 2403 | | |
2369 | | - | |
| 2404 | + | |
2370 | 2405 | | |
2371 | | - | |
2372 | | - | |
2373 | | - | |
2374 | | - | |
| 2406 | + | |
| 2407 | + | |
2375 | 2408 | | |
2376 | 2409 | | |
2377 | 2410 | | |
| |||
2381 | 2414 | | |
2382 | 2415 | | |
2383 | 2416 | | |
| 2417 | + | |
| 2418 | + | |
| 2419 | + | |
| 2420 | + | |
| 2421 | + | |
| 2422 | + | |
| 2423 | + | |
| 2424 | + | |
| 2425 | + | |
| 2426 | + | |
2384 | 2427 | | |
2385 | | - | |
| 2428 | + | |
2386 | 2429 | | |
2387 | | - | |
2388 | | - | |
2389 | | - | |
| 2430 | + | |
| 2431 | + | |
| 2432 | + | |
2390 | 2433 | | |
2391 | 2434 | | |
2392 | 2435 | | |
| |||
0 commit comments