Commit 550d0e7
[SPARK-16482][SQL] Describe Table Command for Tables Requiring Runtime Inferred Schema
#### What changes were proposed in this pull request?
If we create a table pointing to a parquet/json datasets without specifying the schema, describe table command does not show the schema at all. It only shows `# Schema of this table is inferred at runtime`. In 1.6, describe table does show the schema of such a table.
~~For data source tables, to infer the schema, we need to load the data source tables at runtime. Thus, this PR calls the function `lookupRelation`.~~
For data source tables, we infer the schema before table creation. Thus, this PR set the inferred schema as the table schema when table creation.
#### How was this patch tested?
Added test cases
Author: gatorsmile <gatorsmile@gmail.com>
Closes #14148 from gatorsmile/describeSchema.
(cherry picked from commit c5ec879)
Signed-off-by: Yin Huai <yhuai@databricks.com>1 parent 9e3a598 commit 550d0e7
File tree
2 files changed
+22
-22
lines changed- sql
- core/src/main/scala/org/apache/spark/sql/execution/command
- hive/src/test/scala/org/apache/spark/sql/hive/execution
2 files changed
+22
-22
lines changedLines changed: 13 additions & 15 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
413 | 413 | | |
414 | 414 | | |
415 | 415 | | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
416 | 425 | | |
417 | 426 | | |
418 | 427 | | |
419 | 428 | | |
420 | 429 | | |
421 | | - | |
| 430 | + | |
422 | 431 | | |
423 | 432 | | |
424 | 433 | | |
425 | 434 | | |
426 | 435 | | |
427 | 436 | | |
428 | | - | |
429 | | - | |
| 437 | + | |
430 | 438 | | |
431 | | - | |
432 | | - | |
433 | | - | |
434 | | - | |
435 | | - | |
436 | | - | |
437 | | - | |
438 | | - | |
439 | 439 | | |
440 | 440 | | |
441 | 441 | | |
442 | 442 | | |
443 | 443 | | |
444 | 444 | | |
445 | 445 | | |
446 | | - | |
447 | | - | |
448 | 446 | | |
449 | 447 | | |
450 | 448 | | |
| |||
454 | 452 | | |
455 | 453 | | |
456 | 454 | | |
457 | | - | |
| 455 | + | |
458 | 456 | | |
459 | 457 | | |
460 | 458 | | |
461 | 459 | | |
462 | 460 | | |
463 | 461 | | |
464 | | - | |
| 462 | + | |
465 | 463 | | |
466 | 464 | | |
467 | 465 | | |
| |||
Lines changed: 9 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
612 | 612 | | |
613 | 613 | | |
614 | 614 | | |
615 | | - | |
616 | | - | |
617 | | - | |
618 | | - | |
619 | | - | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
620 | 621 | | |
621 | | - | |
| 622 | + | |
622 | 623 | | |
623 | | - | |
| 624 | + | |
| 625 | + | |
624 | 626 | | |
625 | 627 | | |
626 | 628 | | |
| |||
0 commit comments