[ 
https://issues.apache.org/jira/browse/SPARK-30468?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Zhenhua Wang updated SPARK-30468:
---------------------------------
    Description: 
Currently data columns are displayed in one line for show create table command, 
when the table has many columns (to make things even worse, columns may have 
long names or comments), the displayed result is really hard to read.

To improve readability, we could print each column in a separate line. Note 
that other systems like Hive/MySQL also display in this way.

Also, for data columns, table properties and options, we'd better put the right 
parenthesis to the end of the last column/property/option, instead of occupying 
a separate line.

As a result, before the change:
{noformat}
spark-sql> show create table test_table;
CREATE TABLE `test_table` (`col1` INT COMMENT 'This is comment for column 1', 
`col2` STRING COMMENT 'This is comment for column 2', `col3` DOUBLE COMMENT 
'This is comment for column 3')
USING parquet
OPTIONS (
  `bar` '2',
  `foo` '1'
)
TBLPROPERTIES (
  'a' = 'x',
  'b' = 'y'
)
{noformat}
after the change:
{noformat}
spark-sql> show create table test_table;
CREATE TABLE `test_table` (
  `col1` INT COMMENT 'This is comment for column 1',
  `col2` STRING COMMENT 'This is comment for column 2',
  `col3` DOUBLE COMMENT 'This is comment for column 3')
USING parquet
OPTIONS (
  `bar` '2',
  `foo` '1')
TBLPROPERTIES (
  'a' = 'x',
  'b' = 'y')
{noformat}



  was:
Currently data columns are displayed in one line for show create table command, 
when the table has many columns (to make things even worse, columns may have 
long names or comments), the displayed result is really hard to read. E.g.
{noformat}
spark-sql> show create table test_table;

CREATE TABLE `test_table` (`col1` INT COMMENT 'This is comment for column 1', 
`col2` STRING COMMENT 'This is comment for column 2', `col3` DOUBLE COMMENT 
'This is comment for column 3')
USING parquet

{noformat}
To improve readability, we should print each column in a separate line.
{noformat}
spark-sql> show create table test_table;

CREATE TABLE `test_table` (
  `col1` INT COMMENT 'This is comment for column 1',
  `col2` STRING COMMENT 'This is comment for column 2',
  `col3` DOUBLE COMMENT 'This is comment for column 3')
USING parquet

{noformat}


> Use multiple lines to display data columns for show create table command
> ------------------------------------------------------------------------
>
>                 Key: SPARK-30468
>                 URL: https://issues.apache.org/jira/browse/SPARK-30468
>             Project: Spark
>          Issue Type: Improvement
>          Components: SQL
>    Affects Versions: 3.0.0
>            Reporter: Zhenhua Wang
>            Priority: Minor
>
> Currently data columns are displayed in one line for show create table 
> command, when the table has many columns (to make things even worse, columns 
> may have long names or comments), the displayed result is really hard to read.
> To improve readability, we could print each column in a separate line. Note 
> that other systems like Hive/MySQL also display in this way.
> Also, for data columns, table properties and options, we'd better put the 
> right parenthesis to the end of the last column/property/option, instead of 
> occupying a separate line.
> As a result, before the change:
> {noformat}
> spark-sql> show create table test_table;
> CREATE TABLE `test_table` (`col1` INT COMMENT 'This is comment for column 1', 
> `col2` STRING COMMENT 'This is comment for column 2', `col3` DOUBLE COMMENT 
> 'This is comment for column 3')
> USING parquet
> OPTIONS (
>   `bar` '2',
>   `foo` '1'
> )
> TBLPROPERTIES (
>   'a' = 'x',
>   'b' = 'y'
> )
> {noformat}
> after the change:
> {noformat}
> spark-sql> show create table test_table;
> CREATE TABLE `test_table` (
>   `col1` INT COMMENT 'This is comment for column 1',
>   `col2` STRING COMMENT 'This is comment for column 2',
>   `col3` DOUBLE COMMENT 'This is comment for column 3')
> USING parquet
> OPTIONS (
>   `bar` '2',
>   `foo` '1')
> TBLPROPERTIES (
>   'a' = 'x',
>   'b' = 'y')
> {noformat}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to