diff --git a/common/src/java/org/apache/hadoop/hive/common/StatsSetupConst.java b/common/src/java/org/apache/hadoop/hive/common/StatsSetupConst.java index 1466b69..01e6010 100644 --- a/common/src/java/org/apache/hadoop/hive/common/StatsSetupConst.java +++ b/common/src/java/org/apache/hadoop/hive/common/StatsSetupConst.java @@ -137,6 +137,10 @@ public String getAggregator(Configuration conf) { public static final String FALSE = "false"; + // The parameter keys for the table statistics. Those keys are excluded from 'show create table' command output. + public static final String[] TABLE_PARAMS_STATS_KEYS = new String[] { + COLUMN_STATS_ACCURATE, NUM_FILES, TOTAL_SIZE,ROW_COUNT, RAW_DATA_SIZE, NUM_PARTITIONS}; + public static boolean areBasicStatsUptoDate(Map params) { String statsAcc = params.get(COLUMN_STATS_ACCURATE); if (statsAcc == null) { 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 1ebe963..45be365 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 @@ -2209,6 +2209,7 @@ else if (sortCol.getOrder() == BaseSemanticAnalyzer.HIVE_COLUMN_ORDER_DESC) { String tbl_location = " '" + escapeHiveCommand(sd.getLocation()) + "'"; // Table properties + duplicateProps.addAll(Arrays.asList(StatsSetupConst.TABLE_PARAMS_STATS_KEYS)); String tbl_properties = propertiesToString(tbl.getParameters(), duplicateProps); createTab_stmt.add(TEMPORARY, tbl_temp); diff --git a/ql/src/test/results/clientpositive/nullformat.q.out b/ql/src/test/results/clientpositive/nullformat.q.out index 2a80359..af91470 100644 --- a/ql/src/test/results/clientpositive/nullformat.q.out +++ b/ql/src/test/results/clientpositive/nullformat.q.out @@ -93,11 +93,6 @@ OUTPUTFORMAT LOCATION #### A masked pattern was here #### TBLPROPERTIES ( - 'COLUMN_STATS_ACCURATE'='{\"BASIC_STATS\":\"true\"}', - 'numFiles'='0', - 'numRows'='0', - 'rawDataSize'='0', - 'totalSize'='0', #### A masked pattern was here #### PREHOOK: query: -- load null data from another table and verify that the null is stored in the expected format INSERT OVERWRITE TABLE null_tab1 SELECT a,b FROM base_tab diff --git a/ql/src/test/results/clientpositive/nullformatCTAS.q.out b/ql/src/test/results/clientpositive/nullformatCTAS.q.out index 7686419..ea51a56 100644 --- a/ql/src/test/results/clientpositive/nullformatCTAS.q.out +++ b/ql/src/test/results/clientpositive/nullformatCTAS.q.out @@ -176,11 +176,6 @@ OUTPUTFORMAT LOCATION #### A masked pattern was here #### TBLPROPERTIES ( - 'COLUMN_STATS_ACCURATE'='{\"BASIC_STATS\":\"true\"}', - 'numFiles'='1', - 'numRows'='10', - 'rawDataSize'='70', - 'totalSize'='80', #### A masked pattern was here #### 1.01 1.01 diff --git a/ql/src/test/results/clientpositive/show_create_table_alter.q.out b/ql/src/test/results/clientpositive/show_create_table_alter.q.out index d09f30b..d1c1a53 100644 --- a/ql/src/test/results/clientpositive/show_create_table_alter.q.out +++ b/ql/src/test/results/clientpositive/show_create_table_alter.q.out @@ -35,11 +35,6 @@ OUTPUTFORMAT LOCATION #### A masked pattern was here #### TBLPROPERTIES ( - 'COLUMN_STATS_ACCURATE'='{\"BASIC_STATS\":\"true\"}', - 'numFiles'='0', - 'numRows'='0', - 'rawDataSize'='0', - 'totalSize'='0', #### A masked pattern was here #### PREHOOK: query: -- Add a comment to the table, change the EXTERNAL property, and test SHOW CREATE TABLE on the change. ALTER TABLE tmp_showcrt1 SET TBLPROPERTIES ('comment'='temporary table', 'EXTERNAL'='FALSE') @@ -77,11 +72,6 @@ LOCATION TBLPROPERTIES ( 'EXTERNAL'='FALSE', #### A masked pattern was here #### - 'numFiles'='0', - 'numRows'='0', - 'rawDataSize'='0', - 'totalSize'='0', -#### A masked pattern was here #### PREHOOK: query: -- Alter the table comment, change the EXTERNAL property back and test SHOW CREATE TABLE on the change. ALTER TABLE tmp_showcrt1 SET TBLPROPERTIES ('comment'='changed comment', 'EXTERNAL'='TRUE') PREHOOK: type: ALTERTABLE_PROPERTIES @@ -117,11 +107,6 @@ LOCATION #### A masked pattern was here #### TBLPROPERTIES ( #### A masked pattern was here #### - 'numFiles'='0', - 'numRows'='0', - 'rawDataSize'='0', - 'totalSize'='0', -#### A masked pattern was here #### PREHOOK: query: -- Change the 'SORTBUCKETCOLSPREFIX' property and test SHOW CREATE TABLE. The output should not change. ALTER TABLE tmp_showcrt1 SET TBLPROPERTIES ('SORTBUCKETCOLSPREFIX'='FALSE') PREHOOK: type: ALTERTABLE_PROPERTIES @@ -157,11 +142,6 @@ LOCATION #### A masked pattern was here #### TBLPROPERTIES ( #### A masked pattern was here #### - 'numFiles'='0', - 'numRows'='0', - 'rawDataSize'='0', - 'totalSize'='0', -#### A masked pattern was here #### PREHOOK: query: -- Alter the storage handler of the table, and test SHOW CREATE TABLE. ALTER TABLE tmp_showcrt1 SET TBLPROPERTIES ('storage_handler'='org.apache.hadoop.hive.ql.metadata.DefaultStorageHandler') PREHOOK: type: ALTERTABLE_PROPERTIES @@ -197,11 +177,6 @@ LOCATION #### A masked pattern was here #### TBLPROPERTIES ( #### A masked pattern was here #### - 'numFiles'='0', - 'numRows'='0', - 'rawDataSize'='0', - 'totalSize'='0', -#### A masked pattern was here #### PREHOOK: query: DROP TABLE tmp_showcrt1 PREHOOK: type: DROPTABLE PREHOOK: Input: default@tmp_showcrt1 diff --git a/ql/src/test/results/clientpositive/show_create_table_db_table.q.out b/ql/src/test/results/clientpositive/show_create_table_db_table.q.out index daf63e9..495f4b5 100644 --- a/ql/src/test/results/clientpositive/show_create_table_db_table.q.out +++ b/ql/src/test/results/clientpositive/show_create_table_db_table.q.out @@ -46,11 +46,6 @@ OUTPUTFORMAT LOCATION #### A masked pattern was here #### TBLPROPERTIES ( - 'COLUMN_STATS_ACCURATE'='{\"BASIC_STATS\":\"true\"}', - 'numFiles'='0', - 'numRows'='0', - 'rawDataSize'='0', - 'totalSize'='0', #### A masked pattern was here #### PREHOOK: query: DROP TABLE tmp_feng.tmp_showcrt PREHOOK: type: DROPTABLE diff --git a/ql/src/test/results/clientpositive/show_create_table_serde.q.out b/ql/src/test/results/clientpositive/show_create_table_serde.q.out index a7bcb44..44414b2 100644 --- a/ql/src/test/results/clientpositive/show_create_table_serde.q.out +++ b/ql/src/test/results/clientpositive/show_create_table_serde.q.out @@ -41,11 +41,6 @@ LOCATION #### A masked pattern was here #### TBLPROPERTIES ( #### A masked pattern was here #### - 'numFiles'='0', - 'numRows'='0', - 'rawDataSize'='0', - 'totalSize'='0', -#### A masked pattern was here #### PREHOOK: query: DROP TABLE tmp_showcrt1 PREHOOK: type: DROPTABLE PREHOOK: Input: default@tmp_showcrt1 @@ -92,11 +87,6 @@ OUTPUTFORMAT LOCATION #### A masked pattern was here #### TBLPROPERTIES ( - 'COLUMN_STATS_ACCURATE'='{\"BASIC_STATS\":\"true\"}', - 'numFiles'='0', - 'numRows'='0', - 'rawDataSize'='0', - 'totalSize'='0', #### A masked pattern was here #### PREHOOK: query: DROP TABLE tmp_showcrt1 PREHOOK: type: DROPTABLE @@ -146,11 +136,6 @@ OUTPUTFORMAT LOCATION #### A masked pattern was here #### TBLPROPERTIES ( - 'COLUMN_STATS_ACCURATE'='{\"BASIC_STATS\":\"true\"}', - 'numFiles'='0', - 'numRows'='0', - 'rawDataSize'='0', - 'totalSize'='0', #### A masked pattern was here #### PREHOOK: query: DROP TABLE tmp_showcrt1 PREHOOK: type: DROPTABLE @@ -195,11 +180,6 @@ WITH SERDEPROPERTIES ( LOCATION #### A masked pattern was here #### TBLPROPERTIES ( - 'COLUMN_STATS_ACCURATE'='{\"BASIC_STATS\":\"true\"}', - 'numFiles'='0', - 'numRows'='0', - 'rawDataSize'='0', - 'totalSize'='0', #### A masked pattern was here #### PREHOOK: query: DROP TABLE tmp_showcrt1 PREHOOK: type: DROPTABLE