Commit 35ded12
[SPARK-33141][SQL] Capture SQL configs when creating permanent views
### What changes were proposed in this pull request?
This PR makes CreateViewCommand/AlterViewAsCommand capturing runtime SQL configs and store them as view properties. These configs will be applied during the parsing and analysis phases of the view resolution. Users can set `spark.sql.legacy.useCurrentConfigsForView` to `true` to restore the behavior before.
### Why are the changes needed?
This PR is a sub-task of [SPARK-33138](https://issues.apache.org/jira/browse/SPARK-33138) that proposes to unify temp view and permanent view behaviors. This PR makes permanent views mimicking the temp view behavior that "fixes" view semantic by directly storing resolved LogicalPlan. For example, if a user uses spark 2.4 to create a view that contains null values from division-by-zero expressions, she may not want that other users' queries which reference her view throw exceptions when running on spark 3.x with ansi mode on.
### Does this PR introduce _any_ user-facing change?
No.
### How was this patch tested?
added UT + existing UTs (improved)
Closes #30289 from luluorta/SPARK-33141.
Authored-by: luluorta <[email protected]>
Signed-off-by: Wenchen Fan <[email protected]>1 parent b9f2f78 commit 35ded12
File tree
9 files changed
+190
-22
lines changed- docs
- sql
- catalyst/src/main/scala/org/apache/spark/sql
- catalyst
- analysis
- catalog
- plans/logical
- internal
- core/src
- main/scala/org/apache/spark/sql/execution/command
- test
- resources/sql-tests/results/postgreSQL
- scala/org/apache/spark/sql/execution
9 files changed
+190
-22
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
| 54 | + | |
| 55 | + | |
54 | 56 | | |
55 | 57 | | |
56 | 58 | | |
| |||
Lines changed: 3 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1034 | 1034 | | |
1035 | 1035 | | |
1036 | 1036 | | |
1037 | | - | |
| 1037 | + | |
| 1038 | + | |
| 1039 | + | |
1038 | 1040 | | |
1039 | 1041 | | |
1040 | 1042 | | |
| |||
Lines changed: 7 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
795 | 795 | | |
796 | 796 | | |
797 | 797 | | |
798 | | - | |
| 798 | + | |
| 799 | + | |
| 800 | + | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
799 | 804 | | |
800 | 805 | | |
801 | 806 | | |
802 | 807 | | |
803 | 808 | | |
804 | 809 | | |
805 | | - | |
| 810 | + | |
806 | 811 | | |
807 | 812 | | |
808 | 813 | | |
| |||
Lines changed: 18 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
305 | 305 | | |
306 | 306 | | |
307 | 307 | | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
308 | 324 | | |
309 | 325 | | |
310 | 326 | | |
| |||
411 | 427 | | |
412 | 428 | | |
413 | 429 | | |
| 430 | + | |
| 431 | + | |
414 | 432 | | |
415 | 433 | | |
416 | 434 | | |
| |||
Lines changed: 16 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
453 | 453 | | |
454 | 454 | | |
455 | 455 | | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
456 | 472 | | |
457 | 473 | | |
458 | 474 | | |
| |||
Lines changed: 11 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1481 | 1481 | | |
1482 | 1482 | | |
1483 | 1483 | | |
| 1484 | + | |
| 1485 | + | |
| 1486 | + | |
| 1487 | + | |
| 1488 | + | |
| 1489 | + | |
| 1490 | + | |
| 1491 | + | |
| 1492 | + | |
1484 | 1493 | | |
1485 | 1494 | | |
1486 | 1495 | | |
| |||
3415 | 3424 | | |
3416 | 3425 | | |
3417 | 3426 | | |
| 3427 | + | |
| 3428 | + | |
3418 | 3429 | | |
3419 | 3430 | | |
3420 | 3431 | | |
| |||
Lines changed: 45 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
| 30 | + | |
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| |||
334 | 334 | | |
335 | 335 | | |
336 | 336 | | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
337 | 349 | | |
338 | 350 | | |
339 | 351 | | |
| |||
361 | 373 | | |
362 | 374 | | |
363 | 375 | | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
364 | 401 | | |
365 | 402 | | |
366 | 403 | | |
367 | 404 | | |
368 | 405 | | |
| 406 | + | |
369 | 407 | | |
370 | 408 | | |
371 | 409 | | |
| |||
380 | 418 | | |
381 | 419 | | |
382 | 420 | | |
| 421 | + | |
| 422 | + | |
383 | 423 | | |
384 | 424 | | |
385 | 425 | | |
386 | | - | |
| 426 | + | |
387 | 427 | | |
388 | | - | |
| 428 | + | |
389 | 429 | | |
390 | | - | |
| 430 | + | |
391 | 431 | | |
| 432 | + | |
392 | 433 | | |
393 | 434 | | |
394 | 435 | | |
| |||
0 commit comments