Skip to content

Commit

Permalink
ODP-1672: hive schema upgrade from 3.1.4 to 4.0.0 (#24)
Browse files Browse the repository at this point in the history
* 1672: hive schema upgrade from 3.1.4 to 4.0.0

* ODP-1672: resolving conflicts for oracle11g.sql file
  • Loading branch information
basapuram-kumar authored Jun 21, 2024
1 parent 71c96ca commit 68fd48b
Show file tree
Hide file tree
Showing 35 changed files with 13,805 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -823,8 +823,8 @@ FROM
\"PART_COL_STATS\""
);

CREATE OR REPLACE VIEW `VERSION` AS SELECT 1 AS `VER_ID`, '4.0.0-alpha-1' AS `SCHEMA_VERSION`,
'Hive release version 4.0.0-alpha-1' AS `VERSION_COMMENT`;
CREATE OR REPLACE VIEW `VERSION` AS SELECT 1 AS `VER_ID`, '3.1.4' AS `SCHEMA_VERSION`,
'Hive release version 3.1.4' AS `VERSION_COMMENT`;

CREATE EXTERNAL TABLE IF NOT EXISTS `DB_VERSION` (
`VER_ID` BIGINT,
Expand Down Expand Up @@ -1200,7 +1200,7 @@ SELECT
CC_PARTITION,
CASE WHEN CC_TYPE = 'i' THEN 'minor' WHEN CC_TYPE = 'a' THEN 'major' ELSE 'UNKNOWN' END,
CASE WHEN CC_STATE = 'f' THEN 'failed' WHEN CC_STATE = 's' THEN 'succeeded'
WHEN CC_STATE = 'a' THEN 'did not initiate' WHEN CC_STATE = 'c' THEN 'refused' ELSE 'UNKNOWN' END,
WHEN CC_STATE = 'a' THEN 'did not initiate' ELSE 'UNKNOWN' END,
CASE WHEN CC_WORKER_ID IS NULL THEN cast (null as string) ELSE split(CC_WORKER_ID,"-")[0] END,
CASE WHEN CC_WORKER_ID IS NULL THEN cast (null as string) ELSE split(CC_WORKER_ID,"-")[size(split(CC_WORKER_ID,"-"))-1] END,
CC_WORKER_VERSION,
Expand All @@ -1223,7 +1223,7 @@ SELECT
CQ_TABLE,
CQ_PARTITION,
CASE WHEN CQ_TYPE = 'i' THEN 'minor' WHEN CQ_TYPE = 'a' THEN 'major' ELSE 'UNKNOWN' END,
CASE WHEN CQ_STATE = 'i' THEN 'initiated' WHEN CQ_STATE = 'w' THEN 'working' WHEN CQ_STATE = 'r' THEN 'ready for cleaning' ELSE 'UNKNOWN' END,
CASE WHEN CQ_STATE = 'i' THEN 'initiated' WHEN CQ_STATE = 'w' THEN 'working' WHEN CQ_STATE = 'r' THEN 'ready for cleaning' WHEN CQ_STATE = 'c' THEN 'refused' ELSE 'UNKNOWN' END,
CASE WHEN CQ_WORKER_ID IS NULL THEN NULL ELSE split(CQ_WORKER_ID,"-")[0] END,
CASE WHEN CQ_WORKER_ID IS NULL THEN NULL ELSE split(CQ_WORKER_ID,"-")[size(split(CQ_WORKER_ID,"-"))-1] END,
CQ_WORKER_VERSION,
Expand Down Expand Up @@ -1949,4 +1949,3 @@ WHERE




Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
SELECT 'Upgrading MetaStore schema from 3.1.4.3.2.2.0-1 to 3.1.4';

USE SYS;

DROP TABLE IF EXISTS `VERSION`;

CREATE OR REPLACE VIEW `VERSION` AS SELECT 1 AS `VER_ID`, '3.1.4' AS `SCHEMA_VERSION`,
'Hive release version 3.1.4' AS `VERSION_COMMENT`;

SELECT 'Finished upgrading MetaStore schema from 3.1.4.3.2.2.0-1 to 3.1.4';
5 changes: 3 additions & 2 deletions metastore/scripts/upgrade/hive/upgrade.order.hive
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
3.0.0-to-3.1.0
3.1.0-to-4.0.0-alpha-1.hive
4.0.0-alpha-1-to-4.0.0-alpha-2.hive
3.1.0-to-3.1.4.3.2.2.0-1
3.1.4.3.2.2.0-1-to-3.1.4
3.1.4-to-4.0.0-alpha-2.hive
4.0.0-alpha-2-to-4.0.0-beta-1.hive
4.0.0-beta-1-to-4.0.0.hive

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -868,4 +868,4 @@ ALTER TABLE "PACKAGES" ADD CONSTRAINT "PACKAGES_FK1" FOREIGN KEY ("DB_ID") REFER
-- -----------------------------------------------------------------
-- Record schema version. Should be the last step in the init script
-- -----------------------------------------------------------------
INSERT INTO "APP"."VERSION" (VER_ID, SCHEMA_VERSION, VERSION_COMMENT) VALUES (1, '4.0.0-alpha-1', 'Hive release version 4.0.0-alpha-1');
INSERT INTO "APP"."VERSION" (VER_ID, SCHEMA_VERSION, VERSION_COMMENT) VALUES (1, '3.1.4', 'Hive release version 3.1.4');
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
-- Upgrade MetaStore schema from 3.1.4.3.2.2.0-1 to 3.1.4

-- This needs to be the last thing done. Insert any changes above this line.
UPDATE "APP".VERSION SET SCHEMA_VERSION='3.1.4', VERSION_COMMENT='Hive release version 3.1.4' where VER_ID=1;
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
2.3.0-to-3.0.0
3.0.0-to-3.1.0
3.1.0-to-3.2.0
3.2.0-to-4.0.0-alpha-1
4.0.0-alpha-1-to-4.0.0-alpha-2
3.2.0-to-3.1.4.3.2.2.0-1
3.1.4.3.2.2.0-1-to-3.1.4
3.1.4-to-4.0.0-alpha-2
4.0.0-alpha-2-to-4.0.0-beta-1
4.0.0-beta-1-to-4.0.0
Loading

0 comments on commit 68fd48b

Please sign in to comment.