Author: cws Date: Fri Oct 19 00:25:37 2012 New Revision: 1399936 URL: http://svn.apache.org/viewvc?rev=1399936&view=rev Log: derby metastore upgrade script throw errors when updating from 0.7 to 0.8 (Zhenxiao Luo via cws)
Modified: hive/trunk/metastore/scripts/upgrade/derby/008-HIVE-2246.derby.sql Modified: hive/trunk/metastore/scripts/upgrade/derby/008-HIVE-2246.derby.sql URL: http://svn.apache.org/viewvc/hive/trunk/metastore/scripts/upgrade/derby/008-HIVE-2246.derby.sql?rev=1399936&r1=1399935&r2=1399936&view=diff ============================================================================== --- hive/trunk/metastore/scripts/upgrade/derby/008-HIVE-2246.derby.sql (original) +++ hive/trunk/metastore/scripts/upgrade/derby/008-HIVE-2246.derby.sql Fri Oct 19 00:25:37 2012 @@ -50,12 +50,12 @@ ALTER TABLE SDS * for tables. For speed, just let CD_ID = SD_ID for tables */ INSERT INTO CDS (CD_ID) -SELECT t.SD_ID FROM TBLS t WHERE t.SD_ID IS NOT NULL ORDER BY t.SD_ID; +SELECT t.SD_ID FROM TBLS t WHERE t.SD_ID IS NOT NULL; UPDATE SDS SET CD_ID = SD_ID WHERE SD_ID in -(SELECT t.SD_ID FROM TBLS t WHERE t.SD_ID IS NOT NULL ORDER BY t.SD_ID); +(SELECT t.SD_ID FROM TBLS t WHERE t.SD_ID IS NOT NULL); INSERT INTO COLUMNS_V2 (CD_ID, COMMENT, COLUMN_NAME, TYPE_NAME, INTEGER_IDX) @@ -85,7 +85,7 @@ INSERT INTO "SESSION"."TMP_TBL" SELECT FROM PARTITIONS p JOIN TBLS t ON t.TBL_ID = p.TBL_ID JOIN SDS sds on t.SD_ID = sds.SD_ID - WHERE p.SD_ID IS NOT NULL; + WHERE p.SD_ID IS NOT NULL AND sds.CD_ID IS NOT NULL; UPDATE SDS sd SET sd.CD_ID = @@ -96,12 +96,12 @@ UPDATE SDS sd * Migrate IDXS */ INSERT INTO CDS (CD_ID) -SELECT i.SD_ID FROM IDXS i WHERE i.SD_ID IS NOT NULL ORDER BY i.SD_ID; +SELECT i.SD_ID FROM IDXS i WHERE i.SD_ID IS NOT NULL; UPDATE SDS SET CD_ID = SD_ID WHERE SD_ID in -(SELECT i.SD_ID FROM IDXS i WHERE i.SD_ID IS NOT NULL ORDER BY i.SD_ID); +(SELECT i.SD_ID FROM IDXS i WHERE i.SD_ID IS NOT NULL); INSERT INTO COLUMNS_V2 (CD_ID, COMMENT, COLUMN_NAME, TYPE_NAME, INTEGER_IDX)