HIVE-17519: Transpose column stats display (Zoltan Haindrich, reviewed by 
Ashutosh Chauhan and Vineet Garg)

Signed-off-by: Zoltan Haindrich <k...@rxd.hu>


Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/38a594f3
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/38a594f3
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/38a594f3

Branch: refs/heads/master
Commit: 38a594f321d3f5a1ebc33c50c5c2ef6e5bd7845c
Parents: 2902c7c
Author: Zoltan Haindrich <k...@rxd.hu>
Authored: Fri Oct 6 10:51:42 2017 +0200
Committer: Zoltan Haindrich <k...@rxd.hu>
Committed: Fri Oct 6 10:51:45 2017 +0200

----------------------------------------------------------------------
 .../results/positive/external_table_ppd.q.out   |    1 -
 .../positive/hbase_binary_storage_queries.q.out |    2 -
 .../src/test/results/positive/hbase_ddl.q.out   |    2 -
 .../src/test/results/positive/hbasestats.q.out  |    5 -
 ...rt_addpartition_blobstore_to_blobstore.q.out |    4 -
 ...import_addpartition_blobstore_to_local.q.out |    4 -
 ...rt_addpartition_blobstore_to_warehouse.q.out |    4 -
 ...import_addpartition_local_to_blobstore.q.out |    4 -
 .../import_blobstore_to_blobstore.q.out         |    2 -
 .../import_blobstore_to_local.q.out             |    2 -
 .../import_blobstore_to_warehouse.q.out         |    2 -
 .../import_local_to_blobstore.q.out             |    2 -
 .../org/apache/hadoop/hive/ql/exec/DDLTask.java |   18 +-
 .../formatting/MetaDataFormatUtils.java         |  279 +---
 .../formatting/MetaDataPrettyFormatUtils.java   |    1 -
 .../formatting/TextMetaDataFormatter.java       |   46 +-
 .../metadata/formatting/TextMetaDataTable.java  |   61 +
 .../hadoop/hive/ql/plan/DescTableDesc.java      |    2 +-
 .../clientnegative/alter_file_format.q.out      |    1 -
 .../alter_partition_coltype_2columns.q.out      |    1 -
 ...alter_partition_coltype_invalidcolname.q.out |    1 -
 .../alter_partition_coltype_invalidtype.q.out   |    1 -
 ...ter_partition_partial_spec_dyndisabled.q.out |    1 -
 .../alter_view_as_select_with_partition.q.out   |    2 -
 .../results/clientnegative/desc_failure2.q.out  |    1 -
 .../stats_partialscan_autogether.q.out          |    2 -
 .../clientpositive/acid_table_stats.q.out       |   16 -
 ql/src/test/results/clientpositive/alter2.q.out |   12 -
 ql/src/test/results/clientpositive/alter3.q.out |    6 -
 ql/src/test/results/clientpositive/alter5.q.out |    4 -
 .../clientpositive/alterColumnStats.q.out       |   33 +-
 .../clientpositive/alterColumnStatsPart.q.out   |   11 -
 .../clientpositive/alter_file_format.q.out      |   19 -
 .../results/clientpositive/alter_merge_2.q.out  |    1 -
 .../clientpositive/alter_merge_2_orc.q.out      |    1 -
 .../clientpositive/alter_merge_stats.q.out      |    3 -
 ...lter_numbuckets_partitioned_table2_h23.q.out |   36 -
 ...alter_numbuckets_partitioned_table_h23.q.out |   24 -
 .../alter_partition_change_col.q.out            |   13 -
 .../alter_partition_clusterby_sortby.q.out      |    8 -
 .../alter_partition_coltype.q.out               |    4 -
 .../alter_partition_format_loc.q.out            |    6 -
 .../alter_partition_onto_nocurrent_db.q.out     |    2 -
 .../alter_partition_update_status.q.out         |   75 +-
 .../clientpositive/alter_skewed_table.q.out     |    6 -
 .../alter_table_add_partition.q.out             |   10 -
 .../clientpositive/alter_table_cascade.q.out    |   46 -
 .../alter_table_column_stats.q.out              | 1324 +++++++++++++-----
 .../clientpositive/alter_table_not_sorted.q.out |    2 -
 .../clientpositive/alter_table_serde.q.out      |    5 -
 .../clientpositive/alter_table_serde2.q.out     |    8 -
 .../alter_table_stats_status.q.out              |   13 -
 .../alter_table_update_status.q.out             |  720 ++++++++--
 ..._table_update_status_disable_bitvector.q.out |  720 ++++++++--
 .../clientpositive/alter_view_as_select.q.out   |    3 -
 .../analyze_table_null_partition.q.out          |    1 -
 .../clientpositive/analyze_tbl_date.q.out       |    1 -
 .../clientpositive/analyze_tbl_part.q.out       |   45 +-
 .../clientpositive/authorization_index.q.out    |    1 -
 .../clientpositive/autoColumnStats_3.q.out      |   14 -
 .../clientpositive/autoColumnStats_4.q.out      |    3 -
 .../clientpositive/autoColumnStats_5.q.out      |   76 +-
 .../clientpositive/autoColumnStats_8.q.out      |    1 -
 .../clientpositive/autoColumnStats_9.q.out      |   31 +-
 .../clientpositive/avro_add_column3.q.out       |    1 -
 .../results/clientpositive/avro_decimal.q.out   |   15 +-
 .../clientpositive/avro_decimal_native.q.out    |   15 +-
 .../avro_schema_evolution_native.q.out          |    4 -
 .../beeline/escape_comments.q.out               |   14 +-
 .../test/results/clientpositive/bitvector.q.out |   15 +-
 .../clientpositive/colstats_all_nulls.q.out     |   30 +-
 .../columnStatsUpdateForStatsOptimizer_2.q.out  |    4 -
 ...names_with_leading_and_trailing_spaces.q.out |   31 +-
 .../column_pruner_multiple_children.q.out       |   31 +-
 .../clientpositive/columnstats_infinity.q.out   |    3 -
 .../clientpositive/columnstats_partlvl.q.out    |   90 +-
 .../clientpositive/columnstats_partlvl_dp.q.out |  150 +-
 .../clientpositive/columnstats_tbllvl.q.out     |  105 +-
 .../test/results/clientpositive/combine3.q.out  |    2 -
 .../results/clientpositive/compustat_avro.q.out |   30 +-
 .../clientpositive/compute_stats_date.q.out     |   30 +-
 .../confirm_initial_tbl_stats.q.out             |  166 ++-
 .../clientpositive/convert_enum_to_string.q.out |    1 -
 .../create_alter_list_bucketing_table1.q.out    |    7 -
 .../results/clientpositive/create_like.q.out    |   10 -
 .../results/clientpositive/create_like2.q.out   |    1 -
 .../clientpositive/create_like_tbl_props.q.out  |    5 -
 .../clientpositive/create_like_view.q.out       |    5 -
 .../clientpositive/create_or_replace_view.q.out |    9 -
 .../clientpositive/create_skewed_table1.q.out   |    3 -
 .../create_table_like_stats.q.out               |    6 -
 .../results/clientpositive/create_view.q.out    |   14 -
 .../create_view_defaultformats.q.out            |    2 -
 .../create_view_partitioned.q.out               |    7 -
 .../clientpositive/create_view_translate.q.out  |    2 -
 .../create_with_constraints.q.out               |   36 -
 ql/src/test/results/clientpositive/ctas.q.out   |    5 -
 .../results/clientpositive/ctas_colname.q.out   |    7 -
 .../ctas_uses_database_location.q.out           |    1 -
 .../clientpositive/database_location.q.out      |    2 -
 .../clientpositive/dbtxnmgr_query5.q.out        |    1 -
 .../results/clientpositive/decimal_serde.q.out  |    2 -
 .../results/clientpositive/decimal_stats.q.out  |   15 +-
 .../clientpositive/default_file_format.q.out    |   12 -
 .../results/clientpositive/deleteAnalyze.q.out  |   16 +-
 .../clientpositive/desc_tbl_part_cols.q.out     |    1 -
 .../describe_comment_indent.q.out               |    1 -
 .../describe_comment_nonascii.q.out             |    1 -
 .../describe_formatted_view_partitioned.q.out   |    2 -
 .../clientpositive/describe_syntax.q.out        |   61 +-
 .../results/clientpositive/describe_table.q.out |   84 +-
 .../display_colstats_tbllvl.q.out               |  180 ++-
 .../clientpositive/drop_partitions_filter.q.out |    1 -
 .../drop_partitions_filter2.q.out               |    1 -
 .../drop_partitions_filter3.q.out               |    1 -
 .../results/clientpositive/druid_basic1.q.out   |    2 -
 .../results/clientpositive/druid_basic2.q.out   |    1 -
 .../clientpositive/druid_intervals.q.out        |    1 -
 .../clientpositive/druid_timeseries.q.out       |    1 -
 .../results/clientpositive/druid_topn.q.out     |    1 -
 .../encrypted/encryption_insert_values.q.out    |    1 -
 .../encrypted/encryption_move_tbl.q.out         |   60 +-
 .../clientpositive/escape_comments.q.out        |    6 -
 .../clientpositive/exim_02_00_part_empty.q.out  |    1 -
 .../results/clientpositive/exim_02_part.q.out   |    1 -
 .../clientpositive/exim_04_all_part.q.out       |    1 -
 .../clientpositive/exim_04_evolved_parts.q.out  |    3 -
 .../clientpositive/exim_05_some_part.q.out      |    1 -
 .../clientpositive/exim_06_one_part.q.out       |    1 -
 .../exim_07_all_part_over_nonoverlap.q.out      |    1 -
 .../exim_09_part_spec_nonoverlap.q.out          |    1 -
 .../clientpositive/exim_15_external_part.q.out  |    1 -
 .../clientpositive/exim_18_part_external.q.out  |    1 -
 .../exim_19_00_part_external_location.q.out     |    1 -
 .../exim_19_part_external_location.q.out        |    1 -
 .../exim_20_part_managed_location.q.out         |    1 -
 .../clientpositive/exim_hidden_files.q.out      |    2 -
 .../extrapolate_part_stats_full.q.out           |   15 +-
 .../extrapolate_part_stats_partial.q.out        |   30 +-
 .../test/results/clientpositive/fm-sketch.q.out |   75 +-
 ql/src/test/results/clientpositive/hll.q.out    |   75 +-
 .../clientpositive/index_skewtable.q.out        |    1 -
 .../clientpositive/infer_bucket_sort.q.out      |   50 -
 .../infer_bucket_sort_convert_join.q.out        |    4 -
 .../infer_bucket_sort_dyn_part.q.out            |   16 -
 .../infer_bucket_sort_grouping_operators.q.out  |   12 -
 .../infer_bucket_sort_list_bucket.q.out         |    4 -
 .../infer_bucket_sort_map_operators.q.out       |    8 -
 .../infer_bucket_sort_merge.q.out               |    4 -
 .../infer_bucket_sort_multi_insert.q.out        |   16 -
 .../infer_bucket_sort_num_buckets.q.out         |    4 -
 .../infer_bucket_sort_reducers_power_two.q.out  |   12 -
 .../test/results/clientpositive/input10.q.out   |    1 -
 .../results/clientpositive/input_part10.q.out   |    1 -
 .../test/results/clientpositive/inputddl2.q.out |    1 -
 .../test/results/clientpositive/inputddl4.q.out |    2 -
 .../test/results/clientpositive/inputddl6.q.out |    2 -
 .../test/results/clientpositive/inputddl7.q.out |    2 -
 .../test/results/clientpositive/inputddl8.q.out |    1 -
 .../insert_values_orig_table_use_metadata.q.out |   13 -
 .../results/clientpositive/lb_fs_stats.q.out    |    2 -
 .../clientpositive/list_bucket_dml_1.q.out      |    4 -
 .../clientpositive/list_bucket_dml_11.q.out     |    2 -
 .../clientpositive/list_bucket_dml_12.q.out     |    2 -
 .../clientpositive/list_bucket_dml_13.q.out     |    2 -
 .../clientpositive/list_bucket_dml_14.q.out     |    1 -
 .../clientpositive/list_bucket_dml_2.q.out      |    2 -
 .../clientpositive/list_bucket_dml_3.q.out      |    2 -
 .../clientpositive/list_bucket_dml_4.q.out      |    4 -
 .../clientpositive/list_bucket_dml_5.q.out      |    4 -
 .../clientpositive/list_bucket_dml_6.q.out      |    8 -
 .../clientpositive/list_bucket_dml_7.q.out      |    8 -
 .../clientpositive/list_bucket_dml_8.q.out      |    6 -
 .../clientpositive/list_bucket_dml_9.q.out      |    4 -
 .../list_bucket_query_multiskew_1.q.out         |    2 -
 .../list_bucket_query_multiskew_2.q.out         |    2 -
 .../list_bucket_query_multiskew_3.q.out         |    6 -
 .../list_bucket_query_oneskew_1.q.out           |    2 -
 .../list_bucket_query_oneskew_2.q.out           |    2 -
 .../list_bucket_query_oneskew_3.q.out           |    2 -
 .../clientpositive/llap/alter_merge_2_orc.q.out |    1 -
 .../llap/alter_merge_stats_orc.q.out            |    8 -
 .../clientpositive/llap/autoColumnStats_1.q.out |   26 -
 .../clientpositive/llap/autoColumnStats_2.q.out |  148 +-
 .../results/clientpositive/llap/bucket5.q.out   |    1 -
 .../clientpositive/llap/bucket_groupby.q.out    |    4 -
 .../columnStatsUpdateForStatsOptimizer_1.q.out  |   14 -
 ...names_with_leading_and_trailing_spaces.q.out |   31 +-
 .../llap/column_table_stats.q.out               |   26 -
 .../llap/column_table_stats_orc.q.out           |   18 -
 .../llap/columnstats_part_coltype.q.out         |  203 ++-
 .../test/results/clientpositive/llap/ctas.q.out |    5 -
 .../clientpositive/llap/deleteAnalyze.q.out     |   16 +-
 .../llap/dynpart_sort_opt_vectorization.q.out   |   32 -
 .../llap/dynpart_sort_optimization.q.out        |   32 -
 .../llap/dynpart_sort_optimization2.q.out       |   24 -
 .../clientpositive/llap/explainuser_1.q.out     |    1 -
 .../extrapolate_part_stats_partial_ndv.q.out    |  330 ++++-
 .../llap/infer_bucket_sort_bucketed_table.q.out |    2 -
 .../llap/list_bucket_dml_10.q.out               |    2 -
 .../clientpositive/llap/load_dyn_part1.q.out    |    1 -
 .../clientpositive/llap/load_dyn_part2.q.out    |    1 -
 .../clientpositive/llap/load_dyn_part3.q.out    |    1 -
 .../clientpositive/llap/load_dyn_part5.q.out    |    1 -
 .../clientpositive/llap/orc_analyze.q.out       |   42 -
 .../clientpositive/llap/orc_create.q.out        |   10 -
 .../clientpositive/llap/orc_llap_counters.q.out |    1 -
 .../llap/orc_llap_counters1.q.out               |    1 -
 .../clientpositive/llap/schema_evol_stats.q.out |   12 -
 .../llap/selectDistinctStar.q.out               |    2 -
 .../results/clientpositive/llap/stats11.q.out   |    8 -
 .../clientpositive/llap/stats_noscan_1.q.out    |   18 -
 .../clientpositive/llap/stats_only_null.q.out   |   19 +-
 .../llap/tez_bmj_schema_evolution.q.out         |    1 -
 .../clientpositive/llap/tez_fsstat.q.out        |    2 -
 .../llap/tez_schema_evolution.q.out             |    1 -
 .../clientpositive/llap/union_fast_stats.q.out  |   12 +-
 .../clientpositive/llap/union_stats.q.out       |    5 -
 .../results/clientpositive/load_dyn_part1.q.out |    1 -
 .../clientpositive/load_dyn_part10.q.out        |    1 -
 .../clientpositive/load_dyn_part11.q.out        |    1 -
 .../clientpositive/load_dyn_part12.q.out        |    1 -
 .../clientpositive/load_dyn_part13.q.out        |    1 -
 .../clientpositive/load_dyn_part14.q.out        |    1 -
 .../results/clientpositive/load_dyn_part2.q.out |    1 -
 .../results/clientpositive/load_dyn_part3.q.out |    1 -
 .../results/clientpositive/load_dyn_part4.q.out |    1 -
 .../results/clientpositive/load_dyn_part6.q.out |    1 -
 .../results/clientpositive/load_dyn_part7.q.out |    1 -
 .../results/clientpositive/load_dyn_part8.q.out |    1 -
 .../results/clientpositive/load_dyn_part9.q.out |    1 -
 .../materialized_view_describe.q.out            |    4 -
 ql/src/test/results/clientpositive/merge3.q.out |    1 -
 .../clientpositive/named_column_join.q.out      |    3 -
 .../clientpositive/parallel_orderby.q.out       |    2 -
 .../clientpositive/parquet_analyze.q.out        |    2 -
 .../parquet_array_null_element.q.out            |    1 -
 .../results/clientpositive/parquet_create.q.out |    1 -
 .../parquet_mixed_partition_formats.q.out       |    6 -
 .../clientpositive/parquet_partitioned.q.out    |    2 -
 .../results/clientpositive/parquet_serde.q.out  |    6 -
 .../clientpositive/part_inherit_tbl_props.q.out |    2 -
 .../part_inherit_tbl_props_empty.q.out          |    2 -
 .../part_inherit_tbl_props_with_star.q.out      |    2 -
 .../clientpositive/partial_column_stats.q.out   |   15 +-
 .../partition_coltype_literals.q.out            |  107 +-
 .../clientpositive/partition_date2.q.out        |    2 -
 .../clientpositive/partition_schema1.q.out      |    3 -
 .../clientpositive/partition_timestamp2.q.out   |    2 -
 .../results/clientpositive/quotedid_stats.q.out |    2 -
 .../clientpositive/rcfile_default_format.q.out  |    8 -
 .../rename_external_partition_location.q.out    |   68 +-
 .../rename_table_update_column_stats.q.out      |  180 ++-
 .../clientpositive/repl_2_exim_basic.q.out      |    4 -
 .../clientpositive/repl_3_exim_metadata.q.out   |    2 -
 .../sample_islocalmode_hook_use_metadata.q.out  |    1 -
 .../clientpositive/serde_reported_schema.q.out  |    2 -
 .../clientpositive/show_indexes_syntax.q.out    |    2 -
 .../spark/alter_merge_stats_orc.q.out           |    8 -
 .../spark/avro_decimal_native.q.out             |   15 +-
 .../results/clientpositive/spark/bucket5.q.out  |    1 -
 .../results/clientpositive/spark/ctas.q.out     |    5 -
 .../infer_bucket_sort_bucketed_table.q.out      |    2 -
 .../spark/infer_bucket_sort_map_operators.q.out |    8 -
 .../spark/infer_bucket_sort_merge.q.out         |    4 -
 .../spark/infer_bucket_sort_num_buckets.q.out   |    4 -
 .../infer_bucket_sort_reducers_power_two.q.out  |   12 -
 .../spark/list_bucket_dml_10.q.out              |    2 -
 .../spark/list_bucket_dml_2.q.out               |    2 -
 .../clientpositive/spark/load_dyn_part1.q.out   |    1 -
 .../clientpositive/spark/load_dyn_part10.q.out  |    1 -
 .../clientpositive/spark/load_dyn_part11.q.out  |    1 -
 .../clientpositive/spark/load_dyn_part12.q.out  |    1 -
 .../clientpositive/spark/load_dyn_part13.q.out  |    1 -
 .../clientpositive/spark/load_dyn_part14.q.out  |    1 -
 .../clientpositive/spark/load_dyn_part2.q.out   |    1 -
 .../clientpositive/spark/load_dyn_part3.q.out   |    1 -
 .../clientpositive/spark/load_dyn_part4.q.out   |    1 -
 .../clientpositive/spark/load_dyn_part5.q.out   |    1 -
 .../clientpositive/spark/load_dyn_part6.q.out   |    1 -
 .../clientpositive/spark/load_dyn_part7.q.out   |    1 -
 .../clientpositive/spark/load_dyn_part8.q.out   |    1 -
 .../clientpositive/spark/load_dyn_part9.q.out   |    1 -
 .../clientpositive/spark/parallel_orderby.q.out |    2 -
 .../spark/spark_explainuser_1.q.out             |    1 -
 .../results/clientpositive/spark/stats0.q.out   |    4 -
 .../results/clientpositive/spark/stats1.q.out   |    2 -
 .../results/clientpositive/spark/stats10.q.out  |    6 -
 .../results/clientpositive/spark/stats12.q.out  |   10 -
 .../results/clientpositive/spark/stats13.q.out  |   12 -
 .../results/clientpositive/spark/stats14.q.out  |    9 -
 .../results/clientpositive/spark/stats15.q.out  |    9 -
 .../results/clientpositive/spark/stats16.q.out  |    2 -
 .../results/clientpositive/spark/stats18.q.out  |    4 -
 .../results/clientpositive/spark/stats2.q.out   |    4 -
 .../results/clientpositive/spark/stats3.q.out   |    3 -
 .../results/clientpositive/spark/stats5.q.out   |    1 -
 .../results/clientpositive/spark/stats6.q.out   |   10 -
 .../results/clientpositive/spark/stats7.q.out   |    6 -
 .../results/clientpositive/spark/stats8.q.out   |   20 -
 .../results/clientpositive/spark/stats9.q.out   |    1 -
 .../clientpositive/spark/stats_noscan_1.q.out   |   18 -
 .../clientpositive/spark/stats_noscan_2.q.out   |    6 -
 .../clientpositive/spark/stats_only_null.q.out  |   19 +-
 .../spark/stats_partscan_1_23.q.out             |    6 -
 .../results/clientpositive/spark/statsfs.q.out  |   14 -
 .../clientpositive/spark/union_remove_1.q.out   |    1 -
 .../clientpositive/spark/union_remove_10.q.out  |    1 -
 .../clientpositive/spark/union_remove_11.q.out  |    1 -
 .../clientpositive/spark/union_remove_12.q.out  |    1 -
 .../clientpositive/spark/union_remove_13.q.out  |    1 -
 .../clientpositive/spark/union_remove_14.q.out  |    1 -
 .../clientpositive/spark/union_remove_15.q.out  |    2 -
 .../clientpositive/spark/union_remove_16.q.out  |    2 -
 .../clientpositive/spark/union_remove_17.q.out  |    2 -
 .../clientpositive/spark/union_remove_18.q.out  |    2 -
 .../clientpositive/spark/union_remove_19.q.out  |    1 -
 .../clientpositive/spark/union_remove_2.q.out   |    1 -
 .../clientpositive/spark/union_remove_20.q.out  |    1 -
 .../clientpositive/spark/union_remove_21.q.out  |    1 -
 .../clientpositive/spark/union_remove_22.q.out  |    1 -
 .../clientpositive/spark/union_remove_23.q.out  |    1 -
 .../clientpositive/spark/union_remove_24.q.out  |    1 -
 .../clientpositive/spark/union_remove_25.q.out  |    6 -
 .../clientpositive/spark/union_remove_3.q.out   |    1 -
 .../clientpositive/spark/union_remove_4.q.out   |    1 -
 .../clientpositive/spark/union_remove_5.q.out   |    1 -
 .../clientpositive/spark/union_remove_7.q.out   |    1 -
 .../clientpositive/spark/union_remove_8.q.out   |    1 -
 .../clientpositive/spark/union_remove_9.q.out   |    1 -
 ql/src/test/results/clientpositive/stats0.q.out |    4 -
 ql/src/test/results/clientpositive/stats1.q.out |    2 -
 .../test/results/clientpositive/stats10.q.out   |    6 -
 .../test/results/clientpositive/stats12.q.out   |   10 -
 .../test/results/clientpositive/stats13.q.out   |   12 -
 .../test/results/clientpositive/stats14.q.out   |    9 -
 .../test/results/clientpositive/stats15.q.out   |    9 -
 .../test/results/clientpositive/stats16.q.out   |    2 -
 .../test/results/clientpositive/stats18.q.out   |    4 -
 ql/src/test/results/clientpositive/stats2.q.out |    4 -
 ql/src/test/results/clientpositive/stats3.q.out |    3 -
 ql/src/test/results/clientpositive/stats4.q.out |   12 -
 ql/src/test/results/clientpositive/stats5.q.out |    1 -
 ql/src/test/results/clientpositive/stats6.q.out |   10 -
 ql/src/test/results/clientpositive/stats7.q.out |    6 -
 ql/src/test/results/clientpositive/stats8.q.out |   20 -
 ql/src/test/results/clientpositive/stats9.q.out |    1 -
 .../clientpositive/stats_empty_partition.q.out  |    2 -
 .../clientpositive/stats_invalidation.q.out     |    2 -
 .../clientpositive/stats_list_bucket.q.out      |    3 -
 .../results/clientpositive/stats_noscan_1.q.out |   18 -
 .../results/clientpositive/stats_noscan_2.q.out |    6 -
 .../clientpositive/stats_only_null.q.out        |   19 +-
 .../clientpositive/stats_partscan_1_23.q.out    |    6 -
 .../test/results/clientpositive/statsfs.q.out   |   14 -
 .../temp_table_display_colstats_tbllvl.q.out    |  180 ++-
 .../clientpositive/tez/explainanalyze_5.q.out   |    1 -
 .../clientpositive/truncate_column.q.out        |   11 -
 .../results/clientpositive/tunable_ndv.q.out    |  120 +-
 .../clientpositive/unicode_comments.q.out       |    5 -
 .../clientpositive/unicode_notation.q.out       |    3 -
 .../clientpositive/union_pos_alias.q.out        |    1 -
 .../results/clientpositive/union_remove_1.q.out |    1 -
 .../clientpositive/union_remove_10.q.out        |    1 -
 .../clientpositive/union_remove_11.q.out        |    1 -
 .../clientpositive/union_remove_12.q.out        |    1 -
 .../clientpositive/union_remove_13.q.out        |    1 -
 .../clientpositive/union_remove_14.q.out        |    1 -
 .../clientpositive/union_remove_15.q.out        |    2 -
 .../clientpositive/union_remove_16.q.out        |    2 -
 .../clientpositive/union_remove_17.q.out        |    2 -
 .../clientpositive/union_remove_18.q.out        |    2 -
 .../clientpositive/union_remove_19.q.out        |    1 -
 .../results/clientpositive/union_remove_2.q.out |    1 -
 .../clientpositive/union_remove_20.q.out        |    1 -
 .../clientpositive/union_remove_21.q.out        |    1 -
 .../clientpositive/union_remove_22.q.out        |    1 -
 .../clientpositive/union_remove_23.q.out        |    1 -
 .../clientpositive/union_remove_24.q.out        |    1 -
 .../clientpositive/union_remove_25.q.out        |    6 -
 .../results/clientpositive/union_remove_3.q.out |    1 -
 .../results/clientpositive/union_remove_4.q.out |    1 -
 .../results/clientpositive/union_remove_5.q.out |    1 -
 .../results/clientpositive/union_remove_7.q.out |    1 -
 .../results/clientpositive/union_remove_8.q.out |    1 -
 .../results/clientpositive/union_remove_9.q.out |    1 -
 .../results/clientpositive/union_stats.q.out    |    5 -
 .../clientpositive/updateAccessTime.q.out       |    6 -
 .../results/clientpositive/view_alias.q.out     |    6 -
 .../test/results/clientpositive/view_cbo.q.out  |   10 -
 390 files changed, 4651 insertions(+), 3200 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/38a594f3/hbase-handler/src/test/results/positive/external_table_ppd.q.out
----------------------------------------------------------------------
diff --git a/hbase-handler/src/test/results/positive/external_table_ppd.q.out 
b/hbase-handler/src/test/results/positive/external_table_ppd.q.out
index 328131a..cdc43ee 100644
--- a/hbase-handler/src/test/results/positive/external_table_ppd.q.out
+++ b/hbase-handler/src/test/results/positive/external_table_ppd.q.out
@@ -39,7 +39,6 @@ POSTHOOK: query: DESCRIBE FORMATTED t_hbase
 POSTHOOK: type: DESCTABLE
 POSTHOOK: Input: default@t_hbase
 # col_name             data_type               comment             
-                
 key                    string                                      
 tinyint_col            tinyint                                     
 smallint_col           smallint                                    

http://git-wip-us.apache.org/repos/asf/hive/blob/38a594f3/hbase-handler/src/test/results/positive/hbase_binary_storage_queries.q.out
----------------------------------------------------------------------
diff --git 
a/hbase-handler/src/test/results/positive/hbase_binary_storage_queries.q.out 
b/hbase-handler/src/test/results/positive/hbase_binary_storage_queries.q.out
index 5404cd9..153613e 100644
--- a/hbase-handler/src/test/results/positive/hbase_binary_storage_queries.q.out
+++ b/hbase-handler/src/test/results/positive/hbase_binary_storage_queries.q.out
@@ -39,7 +39,6 @@ POSTHOOK: query: DESCRIBE FORMATTED t_hbase
 POSTHOOK: type: DESCTABLE
 POSTHOOK: Input: default@t_hbase
 # col_name             data_type               comment             
-                
 key                    string                                      
 tinyint_col            tinyint                                     
 smallint_col           smallint                                    
@@ -219,7 +218,6 @@ POSTHOOK: query: DESCRIBE FORMATTED t_hbase_1
 POSTHOOK: type: DESCTABLE
 POSTHOOK: Input: default@t_hbase_1
 # col_name             data_type               comment             
-                
 key                    string                                      
 tinyint_col            tinyint                                     
 smallint_col           smallint                                    

http://git-wip-us.apache.org/repos/asf/hive/blob/38a594f3/hbase-handler/src/test/results/positive/hbase_ddl.q.out
----------------------------------------------------------------------
diff --git a/hbase-handler/src/test/results/positive/hbase_ddl.q.out 
b/hbase-handler/src/test/results/positive/hbase_ddl.q.out
index 8cb88ed..c015f29 100644
--- a/hbase-handler/src/test/results/positive/hbase_ddl.q.out
+++ b/hbase-handler/src/test/results/positive/hbase_ddl.q.out
@@ -106,7 +106,6 @@ POSTHOOK: query: desc formatted hbase_table_1
 POSTHOOK: type: DESCTABLE
 POSTHOOK: Input: default@hbase_table_1
 # col_name             data_type               comment             
-                
 key                    int                     It is a column key  
 value                  string                  It is the column string value
                 
@@ -153,7 +152,6 @@ POSTHOOK: query: desc formatted hbase_table_1
 POSTHOOK: type: DESCTABLE
 POSTHOOK: Input: default@hbase_table_1
 # col_name             data_type               comment             
-                
 key                    int                     It is a column key  
 value                  string                  It is the column string value
                 

http://git-wip-us.apache.org/repos/asf/hive/blob/38a594f3/hbase-handler/src/test/results/positive/hbasestats.q.out
----------------------------------------------------------------------
diff --git a/hbase-handler/src/test/results/positive/hbasestats.q.out 
b/hbase-handler/src/test/results/positive/hbasestats.q.out
index b7ef954..29eefd4 100644
--- a/hbase-handler/src/test/results/positive/hbasestats.q.out
+++ b/hbase-handler/src/test/results/positive/hbasestats.q.out
@@ -25,7 +25,6 @@ POSTHOOK: query: desc formatted users
 POSTHOOK: type: DESCTABLE
 POSTHOOK: Input: default@users
 # col_name             data_type               comment             
-                
 key                    string                                      
 state                  string                                      
 country                string                                      
@@ -118,7 +117,6 @@ POSTHOOK: query: desc formatted users
 POSTHOOK: type: DESCTABLE
 POSTHOOK: Input: default@users
 # col_name             data_type               comment             
-                
 key                    string                                      
 state                  string                                      
 country                string                                      
@@ -183,7 +181,6 @@ POSTHOOK: query: desc formatted users
 POSTHOOK: type: DESCTABLE
 POSTHOOK: Input: default@users
 # col_name             data_type               comment             
-                
 key                    string                                      
 state                  string                                      
 country                string                                      
@@ -239,7 +236,6 @@ POSTHOOK: query: desc formatted users
 POSTHOOK: type: DESCTABLE
 POSTHOOK: Input: default@users
 # col_name             data_type               comment             
-                
 key                    string                                      
 state                  string                                      
 country                string                                      
@@ -310,7 +306,6 @@ POSTHOOK: query: desc formatted users
 POSTHOOK: type: DESCTABLE
 POSTHOOK: Input: default@users
 # col_name             data_type               comment             
-                
 key                    string                                      
 state                  string                                      
 country                string                                      

http://git-wip-us.apache.org/repos/asf/hive/blob/38a594f3/itests/hive-blobstore/src/test/results/clientpositive/import_addpartition_blobstore_to_blobstore.q.out
----------------------------------------------------------------------
diff --git 
a/itests/hive-blobstore/src/test/results/clientpositive/import_addpartition_blobstore_to_blobstore.q.out
 
b/itests/hive-blobstore/src/test/results/clientpositive/import_addpartition_blobstore_to_blobstore.q.out
index c1e57ee..8750dbf 100644
--- 
a/itests/hive-blobstore/src/test/results/clientpositive/import_addpartition_blobstore_to_blobstore.q.out
+++ 
b/itests/hive-blobstore/src/test/results/clientpositive/import_addpartition_blobstore_to_blobstore.q.out
@@ -60,7 +60,6 @@ emp_country           string                  two char iso 
code
                 
 # Partition Information                 
 # col_name             data_type               comment             
-                
 emp_country            string                  two char iso code   
                 
 #### A masked pattern was here ####
@@ -145,7 +144,6 @@ emp_country                 string                  two 
char iso code
                 
 # Partition Information                 
 # col_name             data_type               comment             
-                
 emp_country            string                  two char iso code   
                 
 #### A masked pattern was here ####
@@ -191,7 +189,6 @@ emp_country                 string                  two 
char iso code
                 
 # Partition Information                 
 # col_name             data_type               comment             
-                
 emp_country            string                  two char iso code   
                 
 #### A masked pattern was here ####
@@ -245,7 +242,6 @@ emp_country                 string                  two 
char iso code
                 
 # Partition Information                 
 # col_name             data_type               comment             
-                
 emp_country            string                  two char iso code   
                 
 #### A masked pattern was here ####

http://git-wip-us.apache.org/repos/asf/hive/blob/38a594f3/itests/hive-blobstore/src/test/results/clientpositive/import_addpartition_blobstore_to_local.q.out
----------------------------------------------------------------------
diff --git 
a/itests/hive-blobstore/src/test/results/clientpositive/import_addpartition_blobstore_to_local.q.out
 
b/itests/hive-blobstore/src/test/results/clientpositive/import_addpartition_blobstore_to_local.q.out
index 4d296da..4a821ea 100644
--- 
a/itests/hive-blobstore/src/test/results/clientpositive/import_addpartition_blobstore_to_local.q.out
+++ 
b/itests/hive-blobstore/src/test/results/clientpositive/import_addpartition_blobstore_to_local.q.out
@@ -60,7 +60,6 @@ emp_country           string                  two char iso 
code
                 
 # Partition Information                 
 # col_name             data_type               comment             
-                
 emp_country            string                  two char iso code   
                 
 #### A masked pattern was here ####
@@ -145,7 +144,6 @@ emp_country                 string                  two 
char iso code
                 
 # Partition Information                 
 # col_name             data_type               comment             
-                
 emp_country            string                  two char iso code   
                 
 #### A masked pattern was here ####
@@ -191,7 +189,6 @@ emp_country                 string                  two 
char iso code
                 
 # Partition Information                 
 # col_name             data_type               comment             
-                
 emp_country            string                  two char iso code   
                 
 #### A masked pattern was here ####
@@ -245,7 +242,6 @@ emp_country                 string                  two 
char iso code
                 
 # Partition Information                 
 # col_name             data_type               comment             
-                
 emp_country            string                  two char iso code   
                 
 #### A masked pattern was here ####

http://git-wip-us.apache.org/repos/asf/hive/blob/38a594f3/itests/hive-blobstore/src/test/results/clientpositive/import_addpartition_blobstore_to_warehouse.q.out
----------------------------------------------------------------------
diff --git 
a/itests/hive-blobstore/src/test/results/clientpositive/import_addpartition_blobstore_to_warehouse.q.out
 
b/itests/hive-blobstore/src/test/results/clientpositive/import_addpartition_blobstore_to_warehouse.q.out
index fce5ffe..31745a0 100644
--- 
a/itests/hive-blobstore/src/test/results/clientpositive/import_addpartition_blobstore_to_warehouse.q.out
+++ 
b/itests/hive-blobstore/src/test/results/clientpositive/import_addpartition_blobstore_to_warehouse.q.out
@@ -60,7 +60,6 @@ emp_country           string                  two char iso 
code
                 
 # Partition Information                 
 # col_name             data_type               comment             
-                
 emp_country            string                  two char iso code   
                 
 #### A masked pattern was here ####
@@ -141,7 +140,6 @@ emp_country                 string                  two 
char iso code
                 
 # Partition Information                 
 # col_name             data_type               comment             
-                
 emp_country            string                  two char iso code   
                 
 #### A masked pattern was here ####
@@ -183,7 +181,6 @@ emp_country                 string                  two 
char iso code
                 
 # Partition Information                 
 # col_name             data_type               comment             
-                
 emp_country            string                  two char iso code   
                 
 #### A masked pattern was here ####
@@ -233,7 +230,6 @@ emp_country                 string                  two 
char iso code
                 
 # Partition Information                 
 # col_name             data_type               comment             
-                
 emp_country            string                  two char iso code   
                 
 #### A masked pattern was here ####

http://git-wip-us.apache.org/repos/asf/hive/blob/38a594f3/itests/hive-blobstore/src/test/results/clientpositive/import_addpartition_local_to_blobstore.q.out
----------------------------------------------------------------------
diff --git 
a/itests/hive-blobstore/src/test/results/clientpositive/import_addpartition_local_to_blobstore.q.out
 
b/itests/hive-blobstore/src/test/results/clientpositive/import_addpartition_local_to_blobstore.q.out
index 72068c5..8c689d4 100644
--- 
a/itests/hive-blobstore/src/test/results/clientpositive/import_addpartition_local_to_blobstore.q.out
+++ 
b/itests/hive-blobstore/src/test/results/clientpositive/import_addpartition_local_to_blobstore.q.out
@@ -60,7 +60,6 @@ emp_country           string                  two char iso 
code
                 
 # Partition Information                 
 # col_name             data_type               comment             
-                
 emp_country            string                  two char iso code   
                 
 #### A masked pattern was here ####
@@ -143,7 +142,6 @@ emp_country                 string                  two 
char iso code
                 
 # Partition Information                 
 # col_name             data_type               comment             
-                
 emp_country            string                  two char iso code   
                 
 #### A masked pattern was here ####
@@ -187,7 +185,6 @@ emp_country                 string                  two 
char iso code
                 
 # Partition Information                 
 # col_name             data_type               comment             
-                
 emp_country            string                  two char iso code   
                 
 #### A masked pattern was here ####
@@ -239,7 +236,6 @@ emp_country                 string                  two 
char iso code
                 
 # Partition Information                 
 # col_name             data_type               comment             
-                
 emp_country            string                  two char iso code   
                 
 #### A masked pattern was here ####

http://git-wip-us.apache.org/repos/asf/hive/blob/38a594f3/itests/hive-blobstore/src/test/results/clientpositive/import_blobstore_to_blobstore.q.out
----------------------------------------------------------------------
diff --git 
a/itests/hive-blobstore/src/test/results/clientpositive/import_blobstore_to_blobstore.q.out
 
b/itests/hive-blobstore/src/test/results/clientpositive/import_blobstore_to_blobstore.q.out
index b15a22f..741eef5 100644
--- 
a/itests/hive-blobstore/src/test/results/clientpositive/import_blobstore_to_blobstore.q.out
+++ 
b/itests/hive-blobstore/src/test/results/clientpositive/import_blobstore_to_blobstore.q.out
@@ -60,7 +60,6 @@ emp_country           string                  two char iso 
code
                 
 # Partition Information                 
 # col_name             data_type               comment             
-                
 emp_country            string                  two char iso code   
                 
 #### A masked pattern was here ####
@@ -139,7 +138,6 @@ emp_country                 string                  two 
char iso code
                 
 # Partition Information                 
 # col_name             data_type               comment             
-                
 emp_country            string                  two char iso code   
                 
 #### A masked pattern was here ####

http://git-wip-us.apache.org/repos/asf/hive/blob/38a594f3/itests/hive-blobstore/src/test/results/clientpositive/import_blobstore_to_local.q.out
----------------------------------------------------------------------
diff --git 
a/itests/hive-blobstore/src/test/results/clientpositive/import_blobstore_to_local.q.out
 
b/itests/hive-blobstore/src/test/results/clientpositive/import_blobstore_to_local.q.out
index 4d2eeb0..00ab66b 100644
--- 
a/itests/hive-blobstore/src/test/results/clientpositive/import_blobstore_to_local.q.out
+++ 
b/itests/hive-blobstore/src/test/results/clientpositive/import_blobstore_to_local.q.out
@@ -60,7 +60,6 @@ emp_country           string                  two char iso 
code
                 
 # Partition Information                 
 # col_name             data_type               comment             
-                
 emp_country            string                  two char iso code   
                 
 #### A masked pattern was here ####
@@ -139,7 +138,6 @@ emp_country                 string                  two 
char iso code
                 
 # Partition Information                 
 # col_name             data_type               comment             
-                
 emp_country            string                  two char iso code   
                 
 #### A masked pattern was here ####

http://git-wip-us.apache.org/repos/asf/hive/blob/38a594f3/itests/hive-blobstore/src/test/results/clientpositive/import_blobstore_to_warehouse.q.out
----------------------------------------------------------------------
diff --git 
a/itests/hive-blobstore/src/test/results/clientpositive/import_blobstore_to_warehouse.q.out
 
b/itests/hive-blobstore/src/test/results/clientpositive/import_blobstore_to_warehouse.q.out
index 764c86d..01cae7c 100644
--- 
a/itests/hive-blobstore/src/test/results/clientpositive/import_blobstore_to_warehouse.q.out
+++ 
b/itests/hive-blobstore/src/test/results/clientpositive/import_blobstore_to_warehouse.q.out
@@ -60,7 +60,6 @@ emp_country           string                  two char iso 
code
                 
 # Partition Information                 
 # col_name             data_type               comment             
-                
 emp_country            string                  two char iso code   
                 
 #### A masked pattern was here ####
@@ -135,7 +134,6 @@ emp_country                 string                  two 
char iso code
                 
 # Partition Information                 
 # col_name             data_type               comment             
-                
 emp_country            string                  two char iso code   
                 
 #### A masked pattern was here ####

http://git-wip-us.apache.org/repos/asf/hive/blob/38a594f3/itests/hive-blobstore/src/test/results/clientpositive/import_local_to_blobstore.q.out
----------------------------------------------------------------------
diff --git 
a/itests/hive-blobstore/src/test/results/clientpositive/import_local_to_blobstore.q.out
 
b/itests/hive-blobstore/src/test/results/clientpositive/import_local_to_blobstore.q.out
index 56343bb..6e2b38b 100644
--- 
a/itests/hive-blobstore/src/test/results/clientpositive/import_local_to_blobstore.q.out
+++ 
b/itests/hive-blobstore/src/test/results/clientpositive/import_local_to_blobstore.q.out
@@ -60,7 +60,6 @@ emp_country           string                  two char iso 
code
                 
 # Partition Information                 
 # col_name             data_type               comment             
-                
 emp_country            string                  two char iso code   
                 
 #### A masked pattern was here ####
@@ -137,7 +136,6 @@ emp_country                 string                  two 
char iso code
                 
 # Partition Information                 
 # col_name             data_type               comment             
-                
 emp_country            string                  two char iso code   
                 
 #### A masked pattern was here ####

http://git-wip-us.apache.org/repos/asf/hive/blob/38a594f3/ql/src/java/org/apache/hadoop/hive/ql/exec/DDLTask.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/exec/DDLTask.java 
b/ql/src/java/org/apache/hadoop/hive/ql/exec/DDLTask.java
index 4b1df73..aac38eb 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/exec/DDLTask.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/exec/DDLTask.java
@@ -145,6 +145,7 @@ import org.apache.hadoop.hive.ql.metadata.Table;
 import org.apache.hadoop.hive.ql.metadata.UniqueConstraint;
 import org.apache.hadoop.hive.ql.metadata.formatting.MetaDataFormatUtils;
 import org.apache.hadoop.hive.ql.metadata.formatting.MetaDataFormatter;
+import org.apache.hadoop.hive.ql.metadata.formatting.TextMetaDataTable;
 import org.apache.hadoop.hive.ql.parse.AlterTablePartMergeFilesDesc;
 import org.apache.hadoop.hive.ql.parse.BaseSemanticAnalyzer;
 import org.apache.hadoop.hive.ql.parse.DDLSemanticAnalyzer;
@@ -2017,7 +2018,9 @@ public class DDLTask extends Task<DDLWork> implements 
Serializable {
             for (String val : vals) {
               String escapedPath = FileUtils.escapePathName(val);
               assert escapedPath != null;
-              if (escapedPath.equals(val)) continue;
+              if (escapedPath.equals(val)) {
+                continue;
+              }
               String errorMsg = "Repair: Cannot add partition " + 
msckDesc.getTableName()
                   + ':' + part.getPartitionName() + " due to invalid 
characters in the name";
               if (doSkip) {
@@ -2528,8 +2531,6 @@ public class DDLTask extends Task<DDLWork> implements 
Serializable {
       if (showIndexes.isFormatted()) {
         // column headers
         
outStream.write(MetaDataFormatUtils.getIndexColumnsHeader().getBytes(StandardCharsets.UTF_8));
-        outStream.write(terminator);
-        outStream.write(terminator);
       }
 
       for (Index index : indexes)
@@ -2643,8 +2644,11 @@ public class DDLTask extends Task<DDLWork> implements 
Serializable {
       // In case the query is served by HiveServer2, don't pad it with spaces,
       // as HiveServer2 output is consumed by JDBC/ODBC clients.
       boolean isOutputPadded = !SessionState.get().isHiveServerQuery();
-      outStream.writeBytes(MetaDataFormatUtils.getAllColumnsInformation(
-          cols, false, isOutputPadded, null));
+      TextMetaDataTable tmd = new TextMetaDataTable();
+      for (FieldSchema fieldSchema : cols) {
+        tmd.addRow(MetaDataFormatUtils.extractColumnValues(fieldSchema));
+      }
+      outStream.writeBytes(tmd.renderTable(isOutputPadded));
     } catch (IOException e) {
       throw new HiveException(e, ErrorMsg.GENERIC_ERROR);
     } finally {
@@ -2721,7 +2725,9 @@ public class DDLTask extends Task<DDLWork> implements 
Serializable {
     HiveTxnManager txnManager = ctx.getHiveTxnManager();
     HiveLockManager lockMgr = txnManager.getLockManager();
 
-    if (txnManager.useNewShowLocksFormat()) return 
showLocksNewFormat(showLocks, lockMgr);
+    if (txnManager.useNewShowLocksFormat()) {
+      return showLocksNewFormat(showLocks, lockMgr);
+    }
 
     boolean isExt = showLocks.isExt();
     if (lockMgr == null) {

http://git-wip-us.apache.org/repos/asf/hive/blob/38a594f3/ql/src/java/org/apache/hadoop/hive/ql/metadata/formatting/MetaDataFormatUtils.java
----------------------------------------------------------------------
diff --git 
a/ql/src/java/org/apache/hadoop/hive/ql/metadata/formatting/MetaDataFormatUtils.java
 
b/ql/src/java/org/apache/hadoop/hive/ql/metadata/formatting/MetaDataFormatUtils.java
index a7f2967..159fb2b 100644
--- 
a/ql/src/java/org/apache/hadoop/hive/ql/metadata/formatting/MetaDataFormatUtils.java
+++ 
b/ql/src/java/org/apache/hadoop/hive/ql/metadata/formatting/MetaDataFormatUtils.java
@@ -18,7 +18,6 @@
 
 package org.apache.hadoop.hive.ql.metadata.formatting;
 
-import org.apache.commons.codec.binary.Base64;
 import org.apache.commons.lang.StringEscapeUtils;
 import org.apache.hadoop.hive.common.type.HiveDecimal;
 import org.apache.hadoop.hive.conf.HiveConf;
@@ -53,9 +52,10 @@ import org.apache.hadoop.hive.ql.plan.ShowIndexesDesc;
 import org.apache.hadoop.hive.serde2.io.DateWritable;
 import org.apache.hive.common.util.HiveStringUtils;
 
+import com.google.common.collect.Lists;
+
 import java.math.BigInteger;
 import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.Collections;
 import java.util.Comparator;
 import java.util.Date;
@@ -81,81 +81,6 @@ public final class MetaDataFormatUtils {
   private MetaDataFormatUtils() {
   }
 
-  private static void formatColumnsHeader(StringBuilder columnInformation,
-      List<ColumnStatisticsObj> colStats) {
-    columnInformation.append("# "); // Easy for shell scripts to ignore
-    formatOutput(getColumnsHeader(colStats), columnInformation);
-    columnInformation.append(LINE_DELIM);
-  }
-
-  /**
-   * Write formatted information about the given columns to a string
-   * @param cols - list of columns
-   * @param printHeader - if header should be included
-   * @param isOutputPadded - make it more human readable by setting indentation
-   *        with spaces. Turned off for use by HiveServer2
-   * @param colStats
-   * @return string with formatted column information
-   */
-  public static String getAllColumnsInformation(List<FieldSchema> cols,
-      boolean printHeader, boolean isOutputPadded, List<ColumnStatisticsObj> 
colStats) {
-    StringBuilder columnInformation = new 
StringBuilder(DEFAULT_STRINGBUILDER_SIZE);
-    if(printHeader){
-      formatColumnsHeader(columnInformation, colStats);
-    }
-
-    formatAllFields(columnInformation, cols, isOutputPadded, colStats);
-    return columnInformation.toString();
-  }
-
-  /**
-   * Write formatted information about the given columns, including partition
-   * columns to a string
-   * @param cols - list of columns
-   * @param partCols - list of partition columns
-   * @param printHeader - if header should be included
-   * @param isOutputPadded - make it more human readable by setting indentation
-   *        with spaces. Turned off for use by HiveServer2
-   * @return string with formatted column information
-   */
-  public static String getAllColumnsInformation(List<FieldSchema> cols,
-      List<FieldSchema> partCols, boolean printHeader, boolean isOutputPadded, 
boolean showPartColsSep) {
-    StringBuilder columnInformation = new 
StringBuilder(DEFAULT_STRINGBUILDER_SIZE);
-    if(printHeader){
-      formatColumnsHeader(columnInformation, null);
-    }
-    formatAllFields(columnInformation, cols, isOutputPadded, null);
-
-    if ((partCols != null) && !partCols.isEmpty() && showPartColsSep) {
-      columnInformation.append(LINE_DELIM).append("# Partition Information")
-      .append(LINE_DELIM);
-      formatColumnsHeader(columnInformation, null);
-      formatAllFields(columnInformation, partCols, isOutputPadded, null);
-    }
-
-    return columnInformation.toString();
-  }
-
-  /**
-   * Write formatted column information into given StringBuilder
-   * @param tableInfo - StringBuilder to append column information into
-   * @param cols - list of columns
-   * @param isOutputPadded - make it more human readable by setting indentation
-   *        with spaces. Turned off for use by HiveServer2
-   * @param colStats
-   */
-  private static void formatAllFields(StringBuilder tableInfo,
-      List<FieldSchema> cols, boolean isOutputPadded, 
List<ColumnStatisticsObj> colStats) {
-    for (FieldSchema col : cols) {
-      if(isOutputPadded) {
-        formatWithIndentation(col.getName(), col.getType(), getComment(col), 
tableInfo, colStats);
-      }
-      else {
-        formatWithoutIndentation(col.getName(), col.getType(), 
col.getComment(), tableInfo, colStats);
-      }
-    }
-  }
-
   private static String convertToString(Decimal val) {
     if (val == null) {
       return "";
@@ -183,12 +108,12 @@ public final class MetaDataFormatUtils {
       return "";
     }
     byte[] sub = new byte[2];
-    sub[0] = (byte) buf[0];
-    sub[1] = (byte) buf[1];
+    sub[0] = buf[0];
+    sub[1] = buf[1];
     return new String(sub);
   }
 
-  private static ColumnStatisticsObj getColumnStatisticsObject(String colName,
+  static ColumnStatisticsObj getColumnStatisticsObject(String colName,
       String colType, List<ColumnStatisticsObj> colStats) {
     if (colStats != null && !colStats.isEmpty()) {
       for (ColumnStatisticsObj cso : colStats) {
@@ -201,56 +126,6 @@ public final class MetaDataFormatUtils {
     return null;
   }
 
-  private static void formatWithoutIndentation(String name, String type, 
String comment,
-      StringBuilder colBuffer, List<ColumnStatisticsObj> colStats) {
-    colBuffer.append(name);
-    colBuffer.append(FIELD_DELIM);
-    colBuffer.append(type);
-    colBuffer.append(FIELD_DELIM);
-    if (colStats != null) {
-      ColumnStatisticsObj cso = getColumnStatisticsObject(name, type, 
colStats);
-      if (cso != null) {
-        ColumnStatisticsData csd = cso.getStatsData();
-        if (csd.isSetBinaryStats()) {
-          BinaryColumnStatsData bcsd = csd.getBinaryStats();
-          appendColumnStatsNoFormatting(colBuffer, "", "", bcsd.getNumNulls(), 
"",
-              bcsd.getAvgColLen(), bcsd.getMaxColLen(), "", "");
-        } else if (csd.isSetStringStats()) {
-          StringColumnStatsData scsd = csd.getStringStats();
-          appendColumnStatsNoFormatting(colBuffer, "", "", scsd.getNumNulls(), 
scsd.getNumDVs(),
-              scsd.getAvgColLen(), scsd.getMaxColLen(), "", "");
-        } else if (csd.isSetBooleanStats()) {
-          BooleanColumnStatsData bcsd = csd.getBooleanStats();
-          appendColumnStatsNoFormatting(colBuffer, "", "", bcsd.getNumNulls(), 
"", "", "",
-              bcsd.getNumTrues(), bcsd.getNumFalses());
-        } else if (csd.isSetDecimalStats()) {
-          DecimalColumnStatsData dcsd = csd.getDecimalStats();
-          appendColumnStatsNoFormatting(colBuffer, 
convertToString(dcsd.getLowValue()),
-              convertToString(dcsd.getHighValue()), dcsd.getNumNulls(), 
dcsd.getNumDVs(),
-              "", "", "", "");
-        } else if (csd.isSetDoubleStats()) {
-          DoubleColumnStatsData dcsd = csd.getDoubleStats();
-          appendColumnStatsNoFormatting(colBuffer, dcsd.getLowValue(), 
dcsd.getHighValue(),
-              dcsd.getNumNulls(), dcsd.getNumDVs(), "", "", "", "");
-        } else if (csd.isSetLongStats()) {
-          LongColumnStatsData lcsd = csd.getLongStats();
-          appendColumnStatsNoFormatting(colBuffer, lcsd.getLowValue(), 
lcsd.getHighValue(),
-              lcsd.getNumNulls(), lcsd.getNumDVs(), "", "", "", "");
-        } else if (csd.isSetDateStats()) {
-          DateColumnStatsData dcsd = csd.getDateStats();
-          appendColumnStatsNoFormatting(colBuffer,
-              convertToString(dcsd.getLowValue()),
-              convertToString(dcsd.getHighValue()),
-              dcsd.getNumNulls(), dcsd.getNumDVs(), "", "", "", "");
-        }
-      } else {
-        appendColumnStatsNoFormatting(colBuffer, "", "", "", "", "", "", "", 
"");
-      }
-    }
-    colBuffer.append(comment == null ? "" : 
HiveStringUtils.escapeJava(comment));
-    colBuffer.append(LINE_DELIM);
-  }
-
   public static String getIndexInformation(Index index, boolean 
isOutputPadded) {
     StringBuilder indexInfo = new StringBuilder(DEFAULT_STRINGBUILDER_SIZE);
 
@@ -282,10 +157,10 @@ public final class MetaDataFormatUtils {
     IndexType indexType = HiveIndex.getIndexTypeByClassName(indexHandlerClass);
     indexColumns.add(indexType.getName());
 
-    String comment = index.getParameters().get("comment");
-    indexColumns.add(comment == null ? null : 
HiveStringUtils.escapeJava(comment));
+    String comment = 
HiveStringUtils.escapeJava(index.getParameters().get("comment"));
+    indexColumns.add(comment);
 
-    formatOutput(indexColumns.toArray(new String[0]), indexInfo, 
isOutputPadded);
+    formatOutput(indexColumns.toArray(new String[0]), indexInfo, 
isOutputPadded, true);
 
     return indexInfo.toString();
   }
@@ -634,27 +509,35 @@ public final class MetaDataFormatUtils {
    * @param isLastLinePadded Is the last field could be printed in multiple 
lines, if contains
    *                         newlines?
    */
-  private static void formatOutput(String[] fields, StringBuilder tableInfo,
-      boolean isLastLinePadded) {
-    int[] paddings = new int[fields.length-1];
-    if (fields.length > 1) {
-      for (int i = 0; i < fields.length - 1; i++) {
-        if (fields[i] == null) {
-          tableInfo.append(FIELD_DELIM);
-          continue;
+  static void formatOutput(String[] fields, StringBuilder tableInfo,
+      boolean isLastLinePadded, boolean isFormatted) {
+    if (!isFormatted) {
+      for (int i = 0; i < fields.length; i++) {
+        Object value = HiveStringUtils.escapeJava(fields[i]);
+        if (value != null) {
+          tableInfo.append(value);
         }
-        tableInfo.append(String.format("%-" + ALIGNMENT + "s", 
fields[i])).append(FIELD_DELIM);
-        paddings[i] = ALIGNMENT > fields[i].length() ? ALIGNMENT : 
fields[i].length();
+        tableInfo.append((i == fields.length - 1) ? LINE_DELIM : FIELD_DELIM);
       }
-    }
-    if (fields.length > 0) {
-      String value = fields[fields.length-1];
-      String unescapedValue =
-          (isLastLinePadded && value != null) ? 
value.replaceAll("\\\\n|\\\\r|\\\\r\\\\n","\n")
-              :value;
-      indentMultilineValue(unescapedValue, tableInfo, paddings, false);
     } else {
-      tableInfo.append(LINE_DELIM);
+      int[] paddings = new int[fields.length - 1];
+      if (fields.length > 1) {
+        for (int i = 0; i < fields.length - 1; i++) {
+          if (fields[i] == null) {
+            tableInfo.append(FIELD_DELIM);
+            continue;
+          }
+          tableInfo.append(String.format("%-" + ALIGNMENT + "s", 
fields[i])).append(FIELD_DELIM);
+          paddings[i] = ALIGNMENT > fields[i].length() ? ALIGNMENT : 
fields[i].length();
+        }
+      }
+      if (fields.length > 0) {
+        String value = fields[fields.length - 1];
+        String unescapedValue = (isLastLinePadded && value != null) ? 
value.replaceAll("\\\\n|\\\\r|\\\\r\\\\n", "\n") : value;
+        indentMultilineValue(unescapedValue, tableInfo, paddings, false);
+      } else {
+        tableInfo.append(LINE_DELIM);
+      }
     }
   }
 
@@ -664,7 +547,7 @@ public final class MetaDataFormatUtils {
    * @param tableInfo The target builder
    */
   private static void formatOutput(String[] fields, StringBuilder tableInfo) {
-    formatOutput(fields, tableInfo, false);
+    formatOutput(fields, tableInfo, false, true);
   }
 
   /**
@@ -689,68 +572,59 @@ public final class MetaDataFormatUtils {
    * @param tableInfo The target builder
    * @param isOutputPadded Should the value printed as a padded string?
    */
-  protected static void formatOutput(String name, String value, StringBuilder 
tableInfo,
+  static void formatOutput(String name, String value, StringBuilder tableInfo,
       boolean isOutputPadded) {
     String unescapedValue =
         (isOutputPadded && value != null) ? 
value.replaceAll("\\\\n|\\\\r|\\\\r\\\\n","\n"):value;
     formatOutput(name, unescapedValue, tableInfo);
   }
 
-  private static void formatWithIndentation(String colName, String colType, 
String colComment,
-      StringBuilder tableInfo, List<ColumnStatisticsObj> colStats) {
-    tableInfo.append(String.format("%-" + ALIGNMENT + "s", 
colName)).append(FIELD_DELIM);
-    tableInfo.append(String.format("%-" + ALIGNMENT + "s", 
colType)).append(FIELD_DELIM);
+  public static String[] extractColumnValues(FieldSchema col) {
+    return extractColumnValues(col, false, null);
+  }
+
+  public static String[] extractColumnValues(FieldSchema col, boolean 
isColStatsAvailable, ColumnStatisticsObj columnStatisticsObj){
+    List<String> ret = new ArrayList<>();
+    ret.add(col.getName());
+    ret.add(col.getType());
 
-    if (colStats != null) {
-      ColumnStatisticsObj cso = getColumnStatisticsObject(colName, colType, 
colStats);
-      if (cso != null) {
-        ColumnStatisticsData csd = cso.getStatsData();
+    if (isColStatsAvailable) {
+      if (columnStatisticsObj != null) {
+        ColumnStatisticsData csd = columnStatisticsObj.getStatsData();
         if (csd.isSetBinaryStats()) {
           BinaryColumnStatsData bcsd = csd.getBinaryStats();
-          appendColumnStats(tableInfo, "", "", bcsd.getNumNulls(), "", "", 
bcsd.getAvgColLen(),
-              bcsd.getMaxColLen(), "", "");
+          ret.addAll(Lists.newArrayList("", "", "" + bcsd.getNumNulls(), "", 
"" + bcsd.getAvgColLen(), "" + bcsd.getMaxColLen(), "", "", ""));
         } else if (csd.isSetStringStats()) {
           StringColumnStatsData scsd = csd.getStringStats();
-          appendColumnStats(tableInfo, "", "", scsd.getNumNulls(), 
scsd.getNumDVs(),
-              convertToString(scsd.getBitVectors()), scsd.getAvgColLen(),
-              scsd.getMaxColLen(), "", "");
+          ret.addAll(Lists.newArrayList("", "", "" + scsd.getNumNulls(), "" + 
scsd.getNumDVs(), "" + scsd.getAvgColLen(), "" + scsd.getMaxColLen(), "", "",
+              convertToString(scsd.getBitVectors())));
         } else if (csd.isSetBooleanStats()) {
           BooleanColumnStatsData bcsd = csd.getBooleanStats();
-          appendColumnStats(tableInfo, "", "", bcsd.getNumNulls(), "", "", "", 
"",
-              bcsd.getNumTrues(), bcsd.getNumFalses());
+          ret.addAll(Lists.newArrayList("", "", "" + bcsd.getNumNulls(), "", 
"", "", "" + bcsd.getNumTrues(), "" + bcsd.getNumFalses(), ""));
         } else if (csd.isSetDecimalStats()) {
           DecimalColumnStatsData dcsd = csd.getDecimalStats();
-          appendColumnStats(tableInfo, convertToString(dcsd.getLowValue()),
-              convertToString(dcsd.getHighValue()), dcsd.getNumNulls(), 
dcsd.getNumDVs(),
-              convertToString(dcsd.getBitVectors()),
-              "", "", "", "");
+          ret.addAll(Lists.newArrayList(convertToString(dcsd.getLowValue()), 
convertToString(dcsd.getHighValue()), "" + dcsd.getNumNulls(),
+              "" + dcsd.getNumDVs(), "", "", "", "", 
convertToString(dcsd.getBitVectors())));
         } else if (csd.isSetDoubleStats()) {
           DoubleColumnStatsData dcsd = csd.getDoubleStats();
-          appendColumnStats(tableInfo, dcsd.getLowValue(), 
dcsd.getHighValue(), dcsd.getNumNulls(),
-              dcsd.getNumDVs(), convertToString(dcsd.getBitVectors()),
-              "", "", "", "");
+          ret.addAll(Lists.newArrayList("" + dcsd.getLowValue(), "" + 
dcsd.getHighValue(), "" + dcsd.getNumNulls(), "" + dcsd.getNumDVs(), "", "", 
"", "",
+              convertToString(dcsd.getBitVectors())));
         } else if (csd.isSetLongStats()) {
           LongColumnStatsData lcsd = csd.getLongStats();
-          appendColumnStats(tableInfo, lcsd.getLowValue(), 
lcsd.getHighValue(), lcsd.getNumNulls(),
-              lcsd.getNumDVs(), convertToString(lcsd.getBitVectors()),
-              "", "", "", "");
+          ret.addAll(Lists.newArrayList("" + lcsd.getLowValue(), "" + 
lcsd.getHighValue(), "" + lcsd.getNumNulls(), "" + lcsd.getNumDVs(), "", "", 
"", "",
+              convertToString(lcsd.getBitVectors())));
         } else if (csd.isSetDateStats()) {
           DateColumnStatsData dcsd = csd.getDateStats();
-          appendColumnStats(tableInfo,
-              convertToString(dcsd.getLowValue()),
-              convertToString(dcsd.getHighValue()),
-              dcsd.getNumNulls(), dcsd.getNumDVs(),
-              convertToString(dcsd.getBitVectors()),
-              "", "", "", "");
+          ret.addAll(Lists.newArrayList(convertToString(dcsd.getLowValue()), 
convertToString(dcsd.getHighValue()), "" + dcsd.getNumNulls(),
+              "" + dcsd.getNumDVs(), "", "", "", "", 
convertToString(dcsd.getBitVectors())));
         }
       } else {
-        appendColumnStats(tableInfo, "", "", "", "", "", "", "", "", "");
+        ret.addAll(Lists.newArrayList("", "", "", "", "", "", "", "", ""));
+        }
       }
-    }
 
-    int colNameLength = ALIGNMENT > colName.length() ? ALIGNMENT : 
colName.length();
-    int colTypeLength = ALIGNMENT > colType.length() ? ALIGNMENT : 
colType.length();
-    indentMultilineValue(colComment, tableInfo, new int[]{colNameLength, 
colTypeLength}, false);
+    ret.add(getComment(col));
+    return ret.toArray(new String[] {});
   }
 
   /**
@@ -796,32 +670,6 @@ public final class MetaDataFormatUtils {
     }
   }
 
-  private static void appendColumnStats(StringBuilder sb, Object min, Object 
max, Object numNulls,
-      Object ndv, Object bitVector, Object avgColLen, Object maxColLen, Object 
numTrues, Object numFalses) {
-    sb.append(String.format("%-" + ALIGNMENT + "s", min)).append(FIELD_DELIM);
-    sb.append(String.format("%-" + ALIGNMENT + "s", max)).append(FIELD_DELIM);
-    sb.append(String.format("%-" + ALIGNMENT + "s", 
numNulls)).append(FIELD_DELIM);
-    sb.append(String.format("%-" + ALIGNMENT + "s", ndv)).append(FIELD_DELIM);
-    sb.append(String.format("%-" + ALIGNMENT + "s", 
avgColLen)).append(FIELD_DELIM);
-    sb.append(String.format("%-" + ALIGNMENT + "s", 
maxColLen)).append(FIELD_DELIM);
-    sb.append(String.format("%-" + ALIGNMENT + "s", 
numTrues)).append(FIELD_DELIM);
-    sb.append(String.format("%-" + ALIGNMENT + "s", 
numFalses)).append(FIELD_DELIM);
-    sb.append(String.format("%-" + ALIGNMENT + "s", 
bitVector)).append(FIELD_DELIM);
-  }
-
-  private static void appendColumnStatsNoFormatting(StringBuilder sb, Object 
min,
-      Object max, Object numNulls, Object ndv, Object avgColLen, Object 
maxColLen,
-      Object numTrues, Object numFalses) {
-    sb.append(min).append(FIELD_DELIM);
-    sb.append(max).append(FIELD_DELIM);
-    sb.append(numNulls).append(FIELD_DELIM);
-    sb.append(ndv).append(FIELD_DELIM);
-    sb.append(avgColLen).append(FIELD_DELIM);
-    sb.append(maxColLen).append(FIELD_DELIM);
-    sb.append(numTrues).append(FIELD_DELIM);
-    sb.append(numFalses).append(FIELD_DELIM);
-  }
-
   public static String[] getColumnsHeader(List<ColumnStatisticsObj> colStats) {
     boolean showColStats = false;
     if (colStats != null) {
@@ -843,4 +691,5 @@ public final class MetaDataFormatUtils {
       return new 
TextMetaDataFormatter(conf.getIntVar(HiveConf.ConfVars.CLIPRETTYOUTPUTNUMCOLS), 
conf.getBoolVar(ConfVars.HIVE_DISPLAY_PARTITION_COLUMNS_SEPARATELY));
     }
   }
+
 }

http://git-wip-us.apache.org/repos/asf/hive/blob/38a594f3/ql/src/java/org/apache/hadoop/hive/ql/metadata/formatting/MetaDataPrettyFormatUtils.java
----------------------------------------------------------------------
diff --git 
a/ql/src/java/org/apache/hadoop/hive/ql/metadata/formatting/MetaDataPrettyFormatUtils.java
 
b/ql/src/java/org/apache/hadoop/hive/ql/metadata/formatting/MetaDataPrettyFormatUtils.java
index c653252..768ccef 100644
--- 
a/ql/src/java/org/apache/hadoop/hive/ql/metadata/formatting/MetaDataPrettyFormatUtils.java
+++ 
b/ql/src/java/org/apache/hadoop/hive/ql/metadata/formatting/MetaDataPrettyFormatUtils.java
@@ -21,7 +21,6 @@ package org.apache.hadoop.hive.ql.metadata.formatting;
 import java.util.List;
 import java.util.StringTokenizer;
 
-import org.apache.commons.lang.StringEscapeUtils;
 import org.apache.commons.lang.StringUtils;
 import org.apache.hadoop.hive.metastore.api.FieldSchema;
 

http://git-wip-us.apache.org/repos/asf/hive/blob/38a594f3/ql/src/java/org/apache/hadoop/hive/ql/metadata/formatting/TextMetaDataFormatter.java
----------------------------------------------------------------------
diff --git 
a/ql/src/java/org/apache/hadoop/hive/ql/metadata/formatting/TextMetaDataFormatter.java
 
b/ql/src/java/org/apache/hadoop/hive/ql/metadata/formatting/TextMetaDataFormatter.java
index dcecb0e..833dad6 100644
--- 
a/ql/src/java/org/apache/hadoop/hive/ql/metadata/formatting/TextMetaDataFormatter.java
+++ 
b/ql/src/java/org/apache/hadoop/hive/ql/metadata/formatting/TextMetaDataFormatter.java
@@ -128,16 +128,46 @@ class TextMetaDataFormatter implements MetaDataFormatter {
       PrimaryKeyInfo pkInfo, ForeignKeyInfo fkInfo,
       UniqueConstraint ukInfo, NotNullConstraint nnInfo) throws HiveException {
     try {
-      String output;
+      List<FieldSchema> partCols = tbl.isPartitioned() ? tbl.getPartCols() : 
null;
+
+      if (isPretty) {
+        String output = 
MetaDataPrettyFormatUtils.getAllColumnsInformation(cols, partCols, 
prettyOutputNumCols);
+        outStream.write(output.getBytes("UTF-8"));
+        return;
+      }
+      String output = "";
+
+      boolean isColStatsAvailable = colStats != null;
+
+      TextMetaDataTable mdt = new TextMetaDataTable();
+      if (isFormatted && !isColStatsAvailable) {
+        output = "# ";
+      }
+      if (isFormatted) {
+        mdt.addRow(MetaDataFormatUtils.getColumnsHeader(colStats));
+      }
+      for (FieldSchema col : cols) {
+        mdt.addRow(MetaDataFormatUtils.extractColumnValues(col, 
isColStatsAvailable,
+            MetaDataFormatUtils.getColumnStatisticsObject(col.getName(), 
col.getType(), colStats)));
+      }
+      if (isColStatsAvailable) {
+        mdt.transpose();
+      }
+      output += mdt.renderTable(isOutputPadded);
+
       if (colPath.equals(tableName)) {
-        List<FieldSchema> partCols = tbl.isPartitioned() ? tbl.getPartCols() : 
null;
-        output = isPretty ?
-            MetaDataPrettyFormatUtils.getAllColumnsInformation(
-                cols, partCols, prettyOutputNumCols)
-                :
-                  MetaDataFormatUtils.getAllColumnsInformation(cols, partCols, 
isFormatted, isOutputPadded, showPartColsSeparately);
+        if ((partCols != null) && !partCols.isEmpty() && 
showPartColsSeparately) {
+
+          mdt = new TextMetaDataTable();
+          output += MetaDataFormatUtils.LINE_DELIM + "# Partition Information" 
+ MetaDataFormatUtils.LINE_DELIM + "# ";
+          mdt.addRow(MetaDataFormatUtils.getColumnsHeader(null));
+          for (FieldSchema col : partCols) {
+            mdt.addRow(MetaDataFormatUtils.extractColumnValues(col));
+          }
+          output += mdt.renderTable(isOutputPadded);
+        }
       } else {
-        output = MetaDataFormatUtils.getAllColumnsInformation(cols, 
isFormatted, isOutputPadded, colStats);
+
         String statsState;
         if (tbl.getParameters() != null && (statsState = 
tbl.getParameters().get(StatsSetupConst.COLUMN_STATS_ACCURATE)) != null) {
           StringBuilder str = new StringBuilder();

http://git-wip-us.apache.org/repos/asf/hive/blob/38a594f3/ql/src/java/org/apache/hadoop/hive/ql/metadata/formatting/TextMetaDataTable.java
----------------------------------------------------------------------
diff --git 
a/ql/src/java/org/apache/hadoop/hive/ql/metadata/formatting/TextMetaDataTable.java
 
b/ql/src/java/org/apache/hadoop/hive/ql/metadata/formatting/TextMetaDataTable.java
new file mode 100644
index 0000000..0f78d3a
--- /dev/null
+++ 
b/ql/src/java/org/apache/hadoop/hive/ql/metadata/formatting/TextMetaDataTable.java
@@ -0,0 +1,61 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hadoop.hive.ql.metadata.formatting;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import com.google.common.collect.Lists;
+
+public class TextMetaDataTable {
+
+  List<List<String>> table = new ArrayList<>();
+
+  public void addRow(String... values) {
+    table.add(Lists.<String> newArrayList(values));
+  }
+
+  public String renderTable(boolean isOutputPadded) {
+    StringBuilder str = new StringBuilder();
+    for (List<String> row : table) {
+      MetaDataFormatUtils.formatOutput(row.toArray(new String[] {}), str, 
isOutputPadded, isOutputPadded);
+    }
+    return str.toString();
+  }
+
+  public void transpose() {
+    if (table.size() == 0) {
+      return;
+    }
+    List<List<String>> newTable = new ArrayList<List<String>>();
+    for (int i = 0; i < table.get(0).size(); i++) {
+      newTable.add(new ArrayList<>());
+    }
+    for (List<String> srcRow : table) {
+      if (newTable.size() != srcRow.size()) {
+        throw new RuntimeException("invalid table size");
+      }
+      for (int i = 0; i < srcRow.size(); i++) {
+        newTable.get(i).add(srcRow.get(i));
+      }
+    }
+    table = newTable;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/hive/blob/38a594f3/ql/src/java/org/apache/hadoop/hive/ql/plan/DescTableDesc.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/plan/DescTableDesc.java 
b/ql/src/java/org/apache/hadoop/hive/ql/plan/DescTableDesc.java
index 845ffcf..88c9921 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/plan/DescTableDesc.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/plan/DescTableDesc.java
@@ -59,7 +59,7 @@ public class DescTableDesc extends DDLDesc implements 
Serializable {
    */
   private static final String schema = 
"col_name,data_type,comment#string:string:string";
   private static final String colStatsSchema = 
"col_name,data_type,min,max,num_nulls,"
-      + 
"distinct_count,avg_col_len,max_col_len,num_trues,num_falses,comment,bitVector"
+      + 
"distinct_count,avg_col_len,max_col_len,num_trues,num_falses,bitVector,comment"
       + 
"#string:string:string:string:string:string:string:string:string:string:string:string";
 
   public DescTableDesc() {

http://git-wip-us.apache.org/repos/asf/hive/blob/38a594f3/ql/src/test/results/clientnegative/alter_file_format.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientnegative/alter_file_format.q.out 
b/ql/src/test/results/clientnegative/alter_file_format.q.out
index 4a79eaa..96259e5 100644
--- a/ql/src/test/results/clientnegative/alter_file_format.q.out
+++ b/ql/src/test/results/clientnegative/alter_file_format.q.out
@@ -13,7 +13,6 @@ POSTHOOK: query: desc FORMATTED alter_file_format_test
 POSTHOOK: type: DESCTABLE
 POSTHOOK: Input: default@alter_file_format_test
 # col_name             data_type               comment             
-                
 key                    int                                         
 value                  string                                      
                 

http://git-wip-us.apache.org/repos/asf/hive/blob/38a594f3/ql/src/test/results/clientnegative/alter_partition_coltype_2columns.q.out
----------------------------------------------------------------------
diff --git 
a/ql/src/test/results/clientnegative/alter_partition_coltype_2columns.q.out 
b/ql/src/test/results/clientnegative/alter_partition_coltype_2columns.q.out
index d9a0624..3d3696b 100644
--- a/ql/src/test/results/clientnegative/alter_partition_coltype_2columns.q.out
+++ b/ql/src/test/results/clientnegative/alter_partition_coltype_2columns.q.out
@@ -29,7 +29,6 @@ ts                    string
                 
 # Partition Information                 
 # col_name             data_type               comment             
-                
 dt                     string                                      
 ts                     string                                      
 FAILED: ParseException line 4:50 mismatched input ',' expecting ) near 'int' 
in alter partition key type

http://git-wip-us.apache.org/repos/asf/hive/blob/38a594f3/ql/src/test/results/clientnegative/alter_partition_coltype_invalidcolname.q.out
----------------------------------------------------------------------
diff --git 
a/ql/src/test/results/clientnegative/alter_partition_coltype_invalidcolname.q.out
 
b/ql/src/test/results/clientnegative/alter_partition_coltype_invalidcolname.q.out
index cc06fc5..78d7e87 100644
--- 
a/ql/src/test/results/clientnegative/alter_partition_coltype_invalidcolname.q.out
+++ 
b/ql/src/test/results/clientnegative/alter_partition_coltype_invalidcolname.q.out
@@ -29,7 +29,6 @@ ts                    string
                 
 # Partition Information                 
 # col_name             data_type               comment             
-                
 dt                     string                                      
 ts                     string                                      
 FAILED: SemanticException [Error 10002]: Invalid column reference dd

http://git-wip-us.apache.org/repos/asf/hive/blob/38a594f3/ql/src/test/results/clientnegative/alter_partition_coltype_invalidtype.q.out
----------------------------------------------------------------------
diff --git 
a/ql/src/test/results/clientnegative/alter_partition_coltype_invalidtype.q.out 
b/ql/src/test/results/clientnegative/alter_partition_coltype_invalidtype.q.out
index 26ef712..f50a25b 100644
--- 
a/ql/src/test/results/clientnegative/alter_partition_coltype_invalidtype.q.out
+++ 
b/ql/src/test/results/clientnegative/alter_partition_coltype_invalidtype.q.out
@@ -29,7 +29,6 @@ ts                    string
                 
 # Partition Information                 
 # col_name             data_type               comment             
-                
 dt                     string                                      
 ts                     string                                      
 FAILED: ParseException line 4:47 cannot recognize input near 'time' ')' 
'<EOF>' in column type

http://git-wip-us.apache.org/repos/asf/hive/blob/38a594f3/ql/src/test/results/clientnegative/alter_partition_partial_spec_dyndisabled.q.out
----------------------------------------------------------------------
diff --git 
a/ql/src/test/results/clientnegative/alter_partition_partial_spec_dyndisabled.q.out
 
b/ql/src/test/results/clientnegative/alter_partition_partial_spec_dyndisabled.q.out
index 8ec2c28..c71c9bf 100644
--- 
a/ql/src/test/results/clientnegative/alter_partition_partial_spec_dyndisabled.q.out
+++ 
b/ql/src/test/results/clientnegative/alter_partition_partial_spec_dyndisabled.q.out
@@ -34,7 +34,6 @@ p2                    string
                 
 # Partition Information                 
 # col_name             data_type               comment             
-                
 p1                     string                                      
 p2                     string                                      
 FAILED: SemanticException [Error 10095]: Dynamic partition is disabled. Either 
enable it by setting hive.exec.dynamic.partition=true or specify partition 
column values

http://git-wip-us.apache.org/repos/asf/hive/blob/38a594f3/ql/src/test/results/clientnegative/alter_view_as_select_with_partition.q.out
----------------------------------------------------------------------
diff --git 
a/ql/src/test/results/clientnegative/alter_view_as_select_with_partition.q.out 
b/ql/src/test/results/clientnegative/alter_view_as_select_with_partition.q.out
index 4893c61..8e240ea 100644
--- 
a/ql/src/test/results/clientnegative/alter_view_as_select_with_partition.q.out
+++ 
b/ql/src/test/results/clientnegative/alter_view_as_select_with_partition.q.out
@@ -38,12 +38,10 @@ POSTHOOK: query: DESCRIBE FORMATTED testViewPart
 POSTHOOK: type: DESCTABLE
 POSTHOOK: Input: default@testviewpart
 # col_name             data_type               comment             
-                
 key                    string                                      
                 
 # Partition Information                 
 # col_name             data_type               comment             
-                
 value                  string                                      
                 
 # Detailed Table Information            

http://git-wip-us.apache.org/repos/asf/hive/blob/38a594f3/ql/src/test/results/clientnegative/desc_failure2.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientnegative/desc_failure2.q.out 
b/ql/src/test/results/clientnegative/desc_failure2.q.out
index 7e55211..8e3836e 100644
--- a/ql/src/test/results/clientnegative/desc_failure2.q.out
+++ b/ql/src/test/results/clientnegative/desc_failure2.q.out
@@ -11,7 +11,6 @@ hr                    string
                 
 # Partition Information                 
 # col_name             data_type               comment             
-                
 ds                     string                                      
 hr                     string                                      
 FAILED: SemanticException [Error 10006]: Partition not found {ds=2012-04-08, 
hr=15}

http://git-wip-us.apache.org/repos/asf/hive/blob/38a594f3/ql/src/test/results/clientnegative/stats_partialscan_autogether.q.out
----------------------------------------------------------------------
diff --git 
a/ql/src/test/results/clientnegative/stats_partialscan_autogether.q.out 
b/ql/src/test/results/clientnegative/stats_partialscan_autogether.q.out
index a88e0b8..680999f 100644
--- a/ql/src/test/results/clientnegative/stats_partialscan_autogether.q.out
+++ b/ql/src/test/results/clientnegative/stats_partialscan_autogether.q.out
@@ -44,13 +44,11 @@ POSTHOOK: query: describe formatted 
analyze_srcpart_partial_scan PARTITION(ds='2
 POSTHOOK: type: DESCTABLE
 POSTHOOK: Input: default@analyze_srcpart_partial_scan
 # col_name             data_type               comment             
-                
 key                    string                                      
 value                  string                                      
                 
 # Partition Information                 
 # col_name             data_type               comment             
-                
 ds                     string                                      
 hr                     string                                      
                 

http://git-wip-us.apache.org/repos/asf/hive/blob/38a594f3/ql/src/test/results/clientpositive/acid_table_stats.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/acid_table_stats.q.out 
b/ql/src/test/results/clientpositive/acid_table_stats.q.out
index 6ab6b43..32c8531 100644
--- a/ql/src/test/results/clientpositive/acid_table_stats.q.out
+++ b/ql/src/test/results/clientpositive/acid_table_stats.q.out
@@ -17,13 +17,11 @@ POSTHOOK: query: desc formatted acid
 POSTHOOK: type: DESCTABLE
 POSTHOOK: Input: default@acid
 # col_name             data_type               comment             
-                
 key                    string                                      
 value                  string                                      
                 
 # Partition Information                 
 # col_name             data_type               comment             
-                
 ds                     string                                      
                 
 # Detailed Table Information            
@@ -80,13 +78,11 @@ POSTHOOK: query: desc formatted acid 
partition(ds='2008-04-08')
 POSTHOOK: type: DESCTABLE
 POSTHOOK: Input: default@acid
 # col_name             data_type               comment             
-                
 key                    string                                      
 value                  string                                      
                 
 # Partition Information                 
 # col_name             data_type               comment             
-                
 ds                     string                                      
                 
 # Detailed Partition Information                
@@ -196,13 +192,11 @@ POSTHOOK: query: desc formatted acid 
partition(ds='2008-04-08')
 POSTHOOK: type: DESCTABLE
 POSTHOOK: Input: default@acid
 # col_name             data_type               comment             
-                
 key                    string                                      
 value                  string                                      
                 
 # Partition Information                 
 # col_name             data_type               comment             
-                
 ds                     string                                      
                 
 # Detailed Partition Information                
@@ -245,13 +239,11 @@ POSTHOOK: query: desc formatted acid 
partition(ds='2008-04-08')
 POSTHOOK: type: DESCTABLE
 POSTHOOK: Input: default@acid
 # col_name             data_type               comment             
-                
 key                    string                                      
 value                  string                                      
                 
 # Partition Information                 
 # col_name             data_type               comment             
-                
 ds                     string                                      
                 
 # Detailed Partition Information                
@@ -373,13 +365,11 @@ POSTHOOK: query: desc formatted acid 
partition(ds='2008-04-08')
 POSTHOOK: type: DESCTABLE
 POSTHOOK: Input: default@acid
 # col_name             data_type               comment             
-                
 key                    string                                      
 value                  string                                      
                 
 # Partition Information                 
 # col_name             data_type               comment             
-                
 ds                     string                                      
                 
 # Detailed Partition Information                
@@ -421,13 +411,11 @@ POSTHOOK: query: desc formatted acid 
partition(ds='2008-04-08')
 POSTHOOK: type: DESCTABLE
 POSTHOOK: Input: default@acid
 # col_name             data_type               comment             
-                
 key                    string                                      
 value                  string                                      
                 
 # Partition Information                 
 # col_name             data_type               comment             
-                
 ds                     string                                      
                 
 # Detailed Partition Information                
@@ -591,13 +579,11 @@ POSTHOOK: query: desc formatted acid
 POSTHOOK: type: DESCTABLE
 POSTHOOK: Input: default@acid
 # col_name             data_type               comment             
-                
 key                    string                                      
 value                  string                                      
                 
 # Partition Information                 
 # col_name             data_type               comment             
-                
 ds                     string                                      
                 
 # Detailed Table Information            
@@ -653,13 +639,11 @@ POSTHOOK: query: desc formatted acid 
partition(ds='2008-04-08')
 POSTHOOK: type: DESCTABLE
 POSTHOOK: Input: default@acid
 # col_name             data_type               comment             
-                
 key                    string                                      
 value                  string                                      
                 
 # Partition Information                 
 # col_name             data_type               comment             
-                
 ds                     string                                      
                 
 # Detailed Partition Information                

http://git-wip-us.apache.org/repos/asf/hive/blob/38a594f3/ql/src/test/results/clientpositive/alter2.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/alter2.q.out 
b/ql/src/test/results/clientpositive/alter2.q.out
index 47ed6d6..18032ac 100644
--- a/ql/src/test/results/clientpositive/alter2.q.out
+++ b/ql/src/test/results/clientpositive/alter2.q.out
@@ -18,7 +18,6 @@ insertdate            string
                 
 # Partition Information                 
 # col_name             data_type               comment             
-                
 insertdate             string                                      
                 
 #### A masked pattern was here ####
@@ -49,7 +48,6 @@ insertdate            string
                 
 # Partition Information                 
 # col_name             data_type               comment             
-                
 insertdate             string                                      
                 
 #### A masked pattern was here ####
@@ -81,7 +79,6 @@ insertdate            string
                 
 # Partition Information                 
 # col_name             data_type               comment             
-                
 insertdate             string                                      
                 
 #### A masked pattern was here ####
@@ -121,7 +118,6 @@ insertdate                  string
                 
 # Partition Information                 
 # col_name             data_type               comment             
-                
 insertdate             string                                      
                 
 #### A masked pattern was here ####
@@ -152,7 +148,6 @@ insertdate                  string
                 
 # Partition Information                 
 # col_name             data_type               comment             
-                
 insertdate             string                                      
                 
 #### A masked pattern was here ####
@@ -184,7 +179,6 @@ insertdate                  string
                 
 # Partition Information                 
 # col_name             data_type               comment             
-                
 insertdate             string                                      
                 
 #### A masked pattern was here ####
@@ -263,7 +257,6 @@ insertdate                  string
                 
 # Partition Information                 
 # col_name             data_type               comment             
-                
 insertdate             string                                      
                 
 #### A masked pattern was here ####
@@ -294,7 +287,6 @@ insertdate                  string
                 
 # Partition Information                 
 # col_name             data_type               comment             
-                
 insertdate             string                                      
                 
 #### A masked pattern was here ####
@@ -326,7 +318,6 @@ insertdate                  string
                 
 # Partition Information                 
 # col_name             data_type               comment             
-                
 insertdate             string                                      
                 
 #### A masked pattern was here ####
@@ -366,7 +357,6 @@ insertdate                  string
                 
 # Partition Information                 
 # col_name             data_type               comment             
-                
 insertdate             string                                      
                 
 #### A masked pattern was here ####
@@ -397,7 +387,6 @@ insertdate                  string
                 
 # Partition Information                 
 # col_name             data_type               comment             
-                
 insertdate             string                                      
                 
 #### A masked pattern was here ####
@@ -429,7 +418,6 @@ insertdate                  string
                 
 # Partition Information                 
 # col_name             data_type               comment             
-                
 insertdate             string                                      
                 
 #### A masked pattern was here ####

Reply via email to