Review Board 1.7.22


HIVE-3678. Provide schema upgrade scripts for schema changes introduced by the addition of Column Statistics support

Review Request #8119 - Created Nov. 18, 2012 and updated

Shreepadma Venugopalan
HIVE-3678
HIVE-3678
Reviewers
hive
ashutoshc, carl
hive-git
Provide metastore schema upgrade scripts for MySQL/Derby/Postgresql/Oracle for the schema changes introduced by HIVE-1362. Change the column statistics schema to allow the metastore schema to be compatible across DB vendors and versions.
Tested the schema upgrade scripts.
metastore/scripts/upgrade/derby/012-HIVE-1362.derby.sql
New File

    
   
1
CREATE TABLE TAB_COL_STATS(

    
   
2
DB_NAME VARCHAR(128) NOT NULL,

    
   
3
TABLE_NAME VARCHAR(128) NOT NULL,

    
   
4
COLUMN_NAME VARCHAR(128) NOT NULL,

    
   
5
COLUMN_TYPE VARCHAR(128) NOT NULL,

    
   
6
LONG_LOW_VALUE BIGINT,

    
   
7
LONG_HIGH_VALUE BIGINT,

    
   
8
DOUBLE_LOW_VALUE DOUBLE,

    
   
9
DOUBLE_HIGH_VALUE DOUBLE,

    
   
10
BIG_DECIMAL_LOW_VALUE VARCHAR(4000),

    
   
11
BIG_DECIMAL_HIGH_VALUE VARCHAR(4000),

    
   
12
NUM_DISTINCTS BIGINT,

    
   
13
NUM_NULLS BIGINT NOT NULL,

    
   
14
AVG_COL_LEN DOUBLE,

    
   
15
MAX_COL_LEN BIGINT,

    
   
16
NUM_TRUES BIGINT,

    
   
17
NUM_FALSES BIGINT,

    
   
18
LAST_ANALYZED BIGINT,

    
   
19
CS_ID BIGINT NOT NULL,

    
   
20
TBL_ID BIGINT NOT NULL

    
   
21
);

    
   
22

   

    
   
23
ALTER TABLE TAB_COL_STATS ADD CONSTRAINT "TAB_COL_STATS_PK" PRIMARY KEY ("CS_ID");

    
   
24
ALTER TABLE TAB_COL_STATS ADD CONSTRAINT "TAB_COL_STATS_FK" FOREIGN KEY ("TBL_ID") REFERENCES TBLS("TBL_ID") ON DELETE NO ACTION ON UPDATE NO ACTION;

    
   
25

   

    
   
26
CREATE TABLE PART_COL_STATS(

    
   
27
DB_NAME VARCHAR(128) NOT NULL,

    
   
28
TABLE_NAME VARCHAR(128) NOT NULL,

    
   
29
PARTITION_NAME VARCHAR(767) NOT NULL,

    
   
30
COLUMN_NAME VARCHAR(128) NOT NULL,

    
   
31
COLUMN_TYPE VARCHAR(128) NOT NULL,

    
   
32
LONG_LOW_VALUE BIGINT,

    
   
33
LONG_HIGH_VALUE BIGINT,

    
   
34
DOUBLE_LOW_VALUE DOUBLE,

    
   
35
DOUBLE_HIGH_VALUE DOUBLE,

    
   
36
BIG_DECIMAL_LOW_VALUE VARCHAR(4000),

    
   
37
BIG_DECIMAL_HIGH_VALUE VARCHAR(4000),

    
   
38
NUM_DISTINCTS BIGINT,

    
   
39
NUM_NULLS BIGINT NOT NULL,

    
   
40
AVG_COL_LEN DOUBLE,

    
   
41
MAX_COL_LEN BIGINT,

    
   
42
NUM_TRUES BIGINT,

    
   
43
NUM_FALSES BIGINT,

    
   
44
LAST_ANALYZED BIGINT,

    
   
45
CS_ID BIGINT NOT NULL,

    
   
46
PART_ID BIGINT NOT NULL

    
   
47
);

    
   
48

   

    
   
49
ALTER TABLE PART_COL_STATS ADD CONSTRAINT "PART_COL_STATS_PK" PRIMARY KEY ("CS_ID");

    
   
50
ALTER TABLE PART_COL_STATS ADD CONSTRAINT "PART_COL_STATS_FK" FOREIGN KEY ("PART_ID") REFERENCES PARTITIONS("PART_ID") ON DELETE NO ACTION ON UPDATE NO ACTION;
metastore/scripts/upgrade/derby/hive-schema-0.10.0.derby.sql
Revision 1be707e New Change
 
metastore/scripts/upgrade/derby/upgrade-0.9.0-to-0.10.0.derby.sql
Revision 714e9d9 New Change
 
metastore/scripts/upgrade/mysql/012-HIVE-1362.mysql.sql
New File
 
metastore/scripts/upgrade/mysql/hive-schema-0.10.0.mysql.sql
Revision 97de3db New Change
 
metastore/scripts/upgrade/mysql/upgrade-0.9.0-to-0.10.0.mysql.sql
Revision 1a85081 New Change
 
metastore/scripts/upgrade/oracle/012-HIVE-1362.oracle.sql
New File
 
metastore/scripts/upgrade/oracle/hive-schema-0.10.0.oracle.sql
Revision 029b931 New Change
 
metastore/scripts/upgrade/postgres/012-HIVE-1362.postgres.sql
New File
 
metastore/scripts/upgrade/postgres/hive-schema-0.10.0.postgres.sql
Revision 2f61644 New Change
 
metastore/scripts/upgrade/postgres/upgrade-0.9.0-to-0.10.0.postgres.sql
Revision d3b6571 New Change
 
metastore/src/java/org/apache/hadoop/hive/metastore/ObjectStore.java
Revision ecc69a2 New Change
 
metastore/src/model/package.jdo
Revision 5f91f97 New Change
 
metastore/src/model/org/apache/hadoop/hive/metastore/model/MPartitionColumnStatistics.java
Revision 500ff29 New Change
 
metastore/src/model/org/apache/hadoop/hive/metastore/model/MTableColumnStatistics.java
Revision 63bf69b New Change
 
  1. metastore/scripts/upgrade/derby/012-HIVE-1362.derby.sql: Loading...
  2. metastore/scripts/upgrade/derby/hive-schema-0.10.0.derby.sql: Loading...
  3. metastore/scripts/upgrade/derby/upgrade-0.9.0-to-0.10.0.derby.sql: Loading...
  4. metastore/scripts/upgrade/mysql/012-HIVE-1362.mysql.sql: Loading...
  5. metastore/scripts/upgrade/mysql/hive-schema-0.10.0.mysql.sql: Loading...
  6. metastore/scripts/upgrade/mysql/upgrade-0.9.0-to-0.10.0.mysql.sql: Loading...
  7. metastore/scripts/upgrade/oracle/012-HIVE-1362.oracle.sql: Loading...
  8. metastore/scripts/upgrade/oracle/hive-schema-0.10.0.oracle.sql: Loading...
  9. metastore/scripts/upgrade/postgres/012-HIVE-1362.postgres.sql: Loading...
  10. metastore/scripts/upgrade/postgres/hive-schema-0.10.0.postgres.sql: Loading...
  11. metastore/scripts/upgrade/postgres/upgrade-0.9.0-to-0.10.0.postgres.sql: Loading...
  12. metastore/src/java/org/apache/hadoop/hive/metastore/ObjectStore.java: Loading...
  13. metastore/src/model/package.jdo: Loading...
  14. metastore/src/model/org/apache/hadoop/hive/metastore/model/MPartitionColumnStatistics.java: Loading...
  15. metastore/src/model/org/apache/hadoop/hive/metastore/model/MTableColumnStatistics.java: Loading...