hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ser...@apache.org
Subject svn commit: r1638688 - /hive/branches/branch-0.14/metastore/scripts/upgrade/oracle/020-HIVE-7784.oracle.sql
Date Wed, 12 Nov 2014 02:10:10 GMT
Author: sershe
Date: Wed Nov 12 02:10:09 2014
New Revision: 1638688

URL: http://svn.apache.org/r1638688
Log:
HIVE-8715 : Hive 14 upgrade scripts can fail for statistics if database was created using
auto-create
 ADDENDUM (Sergey Shelukhin, reviewed by Ashutosh Chauhan and Gunther Hagleitner)

Modified:
    hive/branches/branch-0.14/metastore/scripts/upgrade/oracle/020-HIVE-7784.oracle.sql

Modified: hive/branches/branch-0.14/metastore/scripts/upgrade/oracle/020-HIVE-7784.oracle.sql
URL: http://svn.apache.org/viewvc/hive/branches/branch-0.14/metastore/scripts/upgrade/oracle/020-HIVE-7784.oracle.sql?rev=1638688&r1=1638687&r2=1638688&view=diff
==============================================================================
--- hive/branches/branch-0.14/metastore/scripts/upgrade/oracle/020-HIVE-7784.oracle.sql (original)
+++ hive/branches/branch-0.14/metastore/scripts/upgrade/oracle/020-HIVE-7784.oracle.sql Wed
Nov 12 02:10:09 2014
@@ -1,27 +1,13 @@
 --
 -- Create the table if it doesn't exist.
 --
-CREATE TABLE IF NOT EXISTS PART_COL_STATS (
- CS_ID NUMBER NOT NULL,
- DB_NAME VARCHAR2(128) NOT NULL,
- TABLE_NAME VARCHAR2(128) NOT NULL,
- PARTITION_NAME VARCHAR2(767) NOT NULL,
- COLUMN_NAME VARCHAR2(128) NOT NULL,
- COLUMN_TYPE VARCHAR2(128) NOT NULL,
- PART_ID NUMBER NOT NULL,
- LONG_LOW_VALUE NUMBER,
- LONG_HIGH_VALUE NUMBER,
- DOUBLE_LOW_VALUE NUMBER,
- DOUBLE_HIGH_VALUE NUMBER,
- BIG_DECIMAL_LOW_VALUE VARCHAR2(4000),
- BIG_DECIMAL_HIGH_VALUE VARCHAR2(4000),
- NUM_NULLS NUMBER NOT NULL,
- NUM_DISTINCTS NUMBER,
- AVG_COL_LEN NUMBER,
- MAX_COL_LEN NUMBER,
- NUM_TRUES NUMBER,
- NUM_FALSES NUMBER,
- LAST_ANALYZED NUMBER NOT NULL
-);
+declare pcs_count int;
+begin
+   select count(*) into pcs_count from user_tables where table_name = 'PART_COL_STATS';
+   if pcs_count = 0 then
+     EXECUTE IMMEDIATE 'CREATE TABLE PART_COL_STATS (CS_ID NUMBER NOT NULL, DB_NAME VARCHAR2(128)
NOT NULL, TABLE_NAME VARCHAR2(128) NOT NULL, PARTITION_NAME VARCHAR2(767) NOT NULL, COLUMN_NAME
VARCHAR2(128) NOT NULL, COLUMN_TYPE VARCHAR2(128) NOT NULL, PART_ID NUMBER NOT NULL,     
LONG_LOW_VALUE NUMBER, LONG_HIGH_VALUE NUMBER, DOUBLE_LOW_VALUE NUMBER, DOUBLE_HIGH_VALUE
NUMBER,      BIG_DECIMAL_LOW_VALUE VARCHAR2(4000), BIG_DECIMAL_HIGH_VALUE VARCHAR2(4000),
NUM_NULLS NUMBER NOT NULL, NUM_DISTINCTS NUMBER, AVG_COL_LEN NUMBER, MAX_COL_LEN NUMBER, NUM_TRUES
NUMBER, NUM_FALSES NUMBER, LAST_ANALYZED NUMBER NOT NULL)';
+   end if;
+end;
+/
 
 CREATE INDEX PCS_STATS_IDX ON PART_COL_STATS (DB_NAME,TABLE_NAME,COLUMN_NAME,PARTITION_NAME);



Mime
View raw message