diff --git standalone-metastore/metastore-server/src/main/sql/mssql/hive-schema-4.0.0.mssql.sql standalone-metastore/metastore-server/src/main/sql/mssql/hive-schema-4.0.0.mssql.sql index 538c48897e..91ba134325 100644 --- standalone-metastore/metastore-server/src/main/sql/mssql/hive-schema-4.0.0.mssql.sql +++ standalone-metastore/metastore-server/src/main/sql/mssql/hive-schema-4.0.0.mssql.sql @@ -146,7 +146,7 @@ CREATE TABLE PARTITIONS PART_NAME nvarchar(767) NULL, SD_ID bigint NULL, TBL_ID bigint NULL, - WRITE_ID bigint NULL); + WRITE_ID bigint NOT NULL DEFAULT 0); ALTER TABLE PARTITIONS ADD CONSTRAINT PARTITIONS_PK PRIMARY KEY (PART_ID); @@ -377,7 +377,7 @@ CREATE TABLE TBLS VIEW_EXPANDED_TEXT text NULL, VIEW_ORIGINAL_TEXT text NULL, IS_REWRITE_ENABLED bit NOT NULL DEFAULT 0, - WRITE_ID bigint NULL); + WRITE_ID bigint NOT NULL DEFAULT 0); ALTER TABLE TBLS ADD CONSTRAINT TBLS_PK PRIMARY KEY (TBL_ID); diff --git standalone-metastore/metastore-server/src/main/sql/mssql/upgrade-3.2.0-to-4.0.0.mssql.sql standalone-metastore/metastore-server/src/main/sql/mssql/upgrade-3.2.0-to-4.0.0.mssql.sql index 1d8fc550a3..f0d861b3a9 100644 --- standalone-metastore/metastore-server/src/main/sql/mssql/upgrade-3.2.0-to-4.0.0.mssql.sql +++ standalone-metastore/metastore-server/src/main/sql/mssql/upgrade-3.2.0-to-4.0.0.mssql.sql @@ -1,8 +1,8 @@ SELECT 'Upgrading MetaStore schema from 3.2.0 to 4.0.0' AS MESSAGE; -- HIVE-19416 -ALTER TABLE TBLS ADD WRITE_ID bigint NULL; -ALTER TABLE PARTITIONS ADD WRITE_ID bigint NULL; +ALTER TABLE TBLS ADD WRITE_ID bigint NOT NULL DEFAULT 0; +ALTER TABLE PARTITIONS ADD WRITE_ID bigint NOT NULL DEFAULT 0; -- These lines need to be last. Insert any changes above. UPDATE VERSION SET SCHEMA_VERSION='4.0.0', VERSION_COMMENT='Hive release version 4.0.0' where VER_ID=1; diff --git standalone-metastore/metastore-server/src/main/sql/mysql/upgrade-3.2.0-to-4.0.0.mysql.sql standalone-metastore/metastore-server/src/main/sql/mysql/upgrade-3.2.0-to-4.0.0.mysql.sql index 79e72ab72c..ee0f691b52 100644 --- standalone-metastore/metastore-server/src/main/sql/mysql/upgrade-3.2.0-to-4.0.0.mysql.sql +++ standalone-metastore/metastore-server/src/main/sql/mysql/upgrade-3.2.0-to-4.0.0.mysql.sql @@ -1,8 +1,8 @@ SELECT 'Upgrading MetaStore schema from 3.2.0 to 4.0.0' AS ' '; -- HIVE-19416 -ALTER TABLE TBLS ADD WRITE_ID bigint; -ALTER TABLE PARTITIONS ADD WRITE_ID bigint; +ALTER TABLE TBLS ADD WRITE_ID bigint DEFAULT 0; +ALTER TABLE PARTITIONS ADD WRITE_ID bigint DEFAULT 0; -- These lines need to be last. Insert any changes above. UPDATE VERSION SET SCHEMA_VERSION='4.0.0', VERSION_COMMENT='Hive release version 4.0.0' where VER_ID=1; diff --git standalone-metastore/metastore-server/src/main/sql/oracle/hive-schema-4.0.0.oracle.sql standalone-metastore/metastore-server/src/main/sql/oracle/hive-schema-4.0.0.oracle.sql index 213e23ba4e..2c5d6b2a95 100644 --- standalone-metastore/metastore-server/src/main/sql/oracle/hive-schema-4.0.0.oracle.sql +++ standalone-metastore/metastore-server/src/main/sql/oracle/hive-schema-4.0.0.oracle.sql @@ -164,7 +164,7 @@ CREATE TABLE PARTITIONS PART_NAME VARCHAR2(767) NULL, SD_ID NUMBER NULL, TBL_ID NUMBER NULL, - WRITE_ID NUMBER NULL + WRITE_ID NUMBER DEFAULT 0 NOT NULL ); ALTER TABLE PARTITIONS ADD CONSTRAINT PARTITIONS_PK PRIMARY KEY (PART_ID); @@ -400,7 +400,7 @@ CREATE TABLE TBLS VIEW_EXPANDED_TEXT CLOB NULL, VIEW_ORIGINAL_TEXT CLOB NULL, IS_REWRITE_ENABLED NUMBER(1) DEFAULT 0 NOT NULL CHECK (IS_REWRITE_ENABLED IN (1,0)), - WRITE_ID NUMBER NULL + WRITE_ID NUMBER DEFAULT 0 NOT NULL ); ALTER TABLE TBLS ADD CONSTRAINT TBLS_PK PRIMARY KEY (TBL_ID); diff --git standalone-metastore/metastore-server/src/main/sql/oracle/upgrade-3.2.0-to-4.0.0.oracle.sql standalone-metastore/metastore-server/src/main/sql/oracle/upgrade-3.2.0-to-4.0.0.oracle.sql index aa20a493f9..bbb4a39ec4 100644 --- standalone-metastore/metastore-server/src/main/sql/oracle/upgrade-3.2.0-to-4.0.0.oracle.sql +++ standalone-metastore/metastore-server/src/main/sql/oracle/upgrade-3.2.0-to-4.0.0.oracle.sql @@ -1,7 +1,7 @@ SELECT 'Upgrading MetaStore schema from 3.2.0 to 4.0.0' AS Status from dual; -ALTER TABLE TBLS ADD WRITE_ID number NULL; -ALTER TABLE PARTITIONS ADD WRITE_ID number NULL; +ALTER TABLE TBLS ADD WRITE_ID number DEFAULT 0 NOT NULL; +ALTER TABLE PARTITIONS ADD WRITE_ID number DEFAULT 0 NOT NULL; -- These lines need to be last. Insert any changes above. UPDATE VERSION SET SCHEMA_VERSION='4.0.0', VERSION_COMMENT='Hive release version 4.0.0' where VER_ID=1; diff --git standalone-metastore/metastore-server/src/main/sql/postgres/upgrade-3.2.0-to-4.0.0.postgres.sql standalone-metastore/metastore-server/src/main/sql/postgres/upgrade-3.2.0-to-4.0.0.postgres.sql index f7232a1064..2a2d70ae80 100644 --- standalone-metastore/metastore-server/src/main/sql/postgres/upgrade-3.2.0-to-4.0.0.postgres.sql +++ standalone-metastore/metastore-server/src/main/sql/postgres/upgrade-3.2.0-to-4.0.0.postgres.sql @@ -1,8 +1,8 @@ SELECT 'Upgrading MetaStore schema from 3.2.0 to 4.0.0'; -- HIVE-19416 -ALTER TABLE "TBLS" ADD "WRITE_ID" bigint; -ALTER TABLE "PARTITIONS" ADD "WRITE_ID" bigint; +ALTER TABLE "TBLS" ADD "WRITE_ID" bigint DEFAULT 0; +ALTER TABLE "PARTITIONS" ADD "WRITE_ID" bigint DEFAULT 0; -- These lines need to be last. Insert any changes above. UPDATE "VERSION" SET "SCHEMA_VERSION"='4.0.0', "VERSION_COMMENT"='Hive release version 4.0.0' where "VER_ID"=1;