HIVE-9456 : Make Hive support unicode with MSSQL as Metastore backend (Xiaobing Zhou via Sushanth Sowmyan, reviewed by Thejas Nair)
Project: http://git-wip-us.apache.org/repos/asf/hive/repo Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/8c93f2ba Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/8c93f2ba Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/8c93f2ba Branch: refs/heads/beeline-cli Commit: 8c93f2ba6390ecaf683c4f30d1383d9ce0fdc3b4 Parents: 377ba4b Author: Sushanth Sowmyan <khorg...@gmail.com> Authored: Wed May 6 11:14:01 2015 -0700 Committer: Sushanth Sowmyan <khorg...@gmail.com> Committed: Wed May 6 11:14:55 2015 -0700 ---------------------------------------------------------------------- .../upgrade/mssql/hive-schema-1.2.0.mssql.sql | 256 +++++++++---------- .../upgrade/mssql/hive-schema-1.3.0.mssql.sql | 256 +++++++++---------- .../mssql/upgrade-1.1.0-to-1.2.0.mssql.sql | 1 + 3 files changed, 257 insertions(+), 256 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hive/blob/8c93f2ba/metastore/scripts/upgrade/mssql/hive-schema-1.2.0.mssql.sql ---------------------------------------------------------------------- diff --git a/metastore/scripts/upgrade/mssql/hive-schema-1.2.0.mssql.sql b/metastore/scripts/upgrade/mssql/hive-schema-1.2.0.mssql.sql index e78dcf1..0bbd647 100644 --- a/metastore/scripts/upgrade/mssql/hive-schema-1.2.0.mssql.sql +++ b/metastore/scripts/upgrade/mssql/hive-schema-1.2.0.mssql.sql @@ -49,7 +49,7 @@ CREATE TABLE MASTER_KEYS ( KEY_ID int NOT NULL, - MASTER_KEY varchar(767) NULL + MASTER_KEY nvarchar(767) NULL ); ALTER TABLE MASTER_KEYS ADD CONSTRAINT MASTER_KEYS_PK PRIMARY KEY (KEY_ID); @@ -60,8 +60,8 @@ CREATE TABLE IDXS INDEX_ID bigint NOT NULL, CREATE_TIME int NOT NULL, DEFERRED_REBUILD bit NOT NULL, - INDEX_HANDLER_CLASS varchar(4000) NULL, - INDEX_NAME varchar(128) NULL, + INDEX_HANDLER_CLASS nvarchar(4000) NULL, + INDEX_NAME nvarchar(128) NULL, INDEX_TBL_ID bigint NULL, LAST_ACCESS_TIME int NOT NULL, ORIG_TBL_ID bigint NULL, @@ -75,11 +75,11 @@ CREATE TABLE PART_COL_STATS ( CS_ID bigint NOT NULL, AVG_COL_LEN float NULL, - "COLUMN_NAME" varchar(128) NOT NULL, - COLUMN_TYPE varchar(128) NOT NULL, - DB_NAME varchar(128) NOT NULL, - BIG_DECIMAL_HIGH_VALUE varchar(255) NULL, - BIG_DECIMAL_LOW_VALUE varchar(255) NULL, + "COLUMN_NAME" nvarchar(128) NOT NULL, + COLUMN_TYPE nvarchar(128) NOT NULL, + DB_NAME nvarchar(128) NOT NULL, + BIG_DECIMAL_HIGH_VALUE nvarchar(255) NULL, + BIG_DECIMAL_LOW_VALUE nvarchar(255) NULL, DOUBLE_HIGH_VALUE float NULL, DOUBLE_LOW_VALUE float NULL, LAST_ANALYZED bigint NOT NULL, @@ -91,8 +91,8 @@ CREATE TABLE PART_COL_STATS NUM_NULLS bigint NOT NULL, NUM_TRUES bigint NULL, PART_ID bigint NULL, - PARTITION_NAME varchar(767) NOT NULL, - "TABLE_NAME" varchar(128) NOT NULL + PARTITION_NAME nvarchar(767) NOT NULL, + "TABLE_NAME" nvarchar(128) NOT NULL ); ALTER TABLE PART_COL_STATS ADD CONSTRAINT PART_COL_STATS_PK PRIMARY KEY (CS_ID); @@ -105,12 +105,12 @@ CREATE TABLE PART_PRIVS PART_GRANT_ID bigint NOT NULL, CREATE_TIME int NOT NULL, GRANT_OPTION smallint NOT NULL CHECK (GRANT_OPTION IN (0,1)), - GRANTOR varchar(128) NULL, - GRANTOR_TYPE varchar(128) NULL, + GRANTOR nvarchar(128) NULL, + GRANTOR_TYPE nvarchar(128) NULL, PART_ID bigint NULL, - PRINCIPAL_NAME varchar(128) NULL, - PRINCIPAL_TYPE varchar(128) NULL, - PART_PRIV varchar(128) NULL + PRINCIPAL_NAME nvarchar(128) NULL, + PRINCIPAL_TYPE nvarchar(128) NULL, + PART_PRIV nvarchar(128) NULL ); ALTER TABLE PART_PRIVS ADD CONSTRAINT PART_PRIVS_PK PRIMARY KEY (PART_GRANT_ID); @@ -128,8 +128,8 @@ CREATE TABLE ROLES ( ROLE_ID bigint NOT NULL, CREATE_TIME int NOT NULL, - OWNER_NAME varchar(128) NULL, - ROLE_NAME varchar(128) NULL + OWNER_NAME nvarchar(128) NULL, + ROLE_NAME nvarchar(128) NULL ); ALTER TABLE ROLES ADD CONSTRAINT ROLES_PK PRIMARY KEY (ROLE_ID); @@ -159,8 +159,8 @@ ALTER TABLE CDS ADD CONSTRAINT CDS_PK PRIMARY KEY (CD_ID); CREATE TABLE VERSION ( VER_ID bigint NOT NULL, - SCHEMA_VERSION varchar(127) NOT NULL, - VERSION_COMMENT varchar(255) NOT NULL + SCHEMA_VERSION nvarchar(127) NOT NULL, + VERSION_COMMENT nvarchar(255) NOT NULL ); ALTER TABLE VERSION ADD CONSTRAINT VERSION_PK PRIMARY KEY (VER_ID); @@ -171,11 +171,11 @@ CREATE TABLE GLOBAL_PRIVS USER_GRANT_ID bigint NOT NULL, CREATE_TIME int NOT NULL, GRANT_OPTION smallint NOT NULL CHECK (GRANT_OPTION IN (0,1)), - GRANTOR varchar(128) NULL, - GRANTOR_TYPE varchar(128) NULL, - PRINCIPAL_NAME varchar(128) NULL, - PRINCIPAL_TYPE varchar(128) NULL, - USER_PRIV varchar(128) NULL + GRANTOR nvarchar(128) NULL, + GRANTOR_TYPE nvarchar(128) NULL, + PRINCIPAL_NAME nvarchar(128) NULL, + PRINCIPAL_TYPE nvarchar(128) NULL, + USER_PRIV nvarchar(128) NULL ); ALTER TABLE GLOBAL_PRIVS ADD CONSTRAINT GLOBAL_PRIVS_PK PRIMARY KEY (USER_GRANT_ID); @@ -184,15 +184,15 @@ ALTER TABLE GLOBAL_PRIVS ADD CONSTRAINT GLOBAL_PRIVS_PK PRIMARY KEY (USER_GRANT_ CREATE TABLE PART_COL_PRIVS ( PART_COLUMN_GRANT_ID bigint NOT NULL, - "COLUMN_NAME" varchar(128) NULL, + "COLUMN_NAME" nvarchar(128) NULL, CREATE_TIME int NOT NULL, GRANT_OPTION smallint NOT NULL CHECK (GRANT_OPTION IN (0,1)), - GRANTOR varchar(128) NULL, - GRANTOR_TYPE varchar(128) NULL, + GRANTOR nvarchar(128) NULL, + GRANTOR_TYPE nvarchar(128) NULL, PART_ID bigint NULL, - PRINCIPAL_NAME varchar(128) NULL, - PRINCIPAL_TYPE varchar(128) NULL, - PART_COL_PRIV varchar(128) NULL + PRINCIPAL_NAME nvarchar(128) NULL, + PRINCIPAL_TYPE nvarchar(128) NULL, + PART_COL_PRIV nvarchar(128) NULL ); ALTER TABLE PART_COL_PRIVS ADD CONSTRAINT PART_COL_PRIVS_PK PRIMARY KEY (PART_COLUMN_GRANT_ID); @@ -204,11 +204,11 @@ CREATE TABLE DB_PRIVS CREATE_TIME int NOT NULL, DB_ID bigint NULL, GRANT_OPTION smallint NOT NULL CHECK (GRANT_OPTION IN (0,1)), - GRANTOR varchar(128) NULL, - GRANTOR_TYPE varchar(128) NULL, - PRINCIPAL_NAME varchar(128) NULL, - PRINCIPAL_TYPE varchar(128) NULL, - DB_PRIV varchar(128) NULL + GRANTOR nvarchar(128) NULL, + GRANTOR_TYPE nvarchar(128) NULL, + PRINCIPAL_NAME nvarchar(128) NULL, + PRINCIPAL_TYPE nvarchar(128) NULL, + DB_PRIV nvarchar(128) NULL ); ALTER TABLE DB_PRIVS ADD CONSTRAINT DB_PRIVS_PK PRIMARY KEY (DB_GRANT_ID); @@ -218,11 +218,11 @@ CREATE TABLE TAB_COL_STATS ( CS_ID bigint NOT NULL, AVG_COL_LEN float NULL, - "COLUMN_NAME" varchar(128) NOT NULL, - COLUMN_TYPE varchar(128) NOT NULL, - DB_NAME varchar(128) NOT NULL, - BIG_DECIMAL_HIGH_VALUE varchar(255) NULL, - BIG_DECIMAL_LOW_VALUE varchar(255) NULL, + "COLUMN_NAME" nvarchar(128) NOT NULL, + COLUMN_TYPE nvarchar(128) NOT NULL, + DB_NAME nvarchar(128) NOT NULL, + BIG_DECIMAL_HIGH_VALUE nvarchar(255) NULL, + BIG_DECIMAL_LOW_VALUE nvarchar(255) NULL, DOUBLE_HIGH_VALUE float NULL, DOUBLE_LOW_VALUE float NULL, LAST_ANALYZED bigint NOT NULL, @@ -234,7 +234,7 @@ CREATE TABLE TAB_COL_STATS NUM_NULLS bigint NOT NULL, NUM_TRUES bigint NULL, TBL_ID bigint NULL, - "TABLE_NAME" varchar(128) NOT NULL + "TABLE_NAME" nvarchar(128) NOT NULL ); ALTER TABLE TAB_COL_STATS ADD CONSTRAINT TAB_COL_STATS_PK PRIMARY KEY (CS_ID); @@ -243,9 +243,9 @@ ALTER TABLE TAB_COL_STATS ADD CONSTRAINT TAB_COL_STATS_PK PRIMARY KEY (CS_ID); CREATE TABLE TYPES ( TYPES_ID bigint NOT NULL, - TYPE_NAME varchar(128) NULL, - TYPE1 varchar(767) NULL, - TYPE2 varchar(767) NULL + TYPE_NAME nvarchar(128) NULL, + TYPE1 nvarchar(767) NULL, + TYPE2 nvarchar(767) NULL ); ALTER TABLE TYPES ADD CONSTRAINT TYPES_PK PRIMARY KEY (TYPES_ID); @@ -256,11 +256,11 @@ CREATE TABLE TBL_PRIVS TBL_GRANT_ID bigint NOT NULL, CREATE_TIME int NOT NULL, GRANT_OPTION smallint NOT NULL CHECK (GRANT_OPTION IN (0,1)), - GRANTOR varchar(128) NULL, - GRANTOR_TYPE varchar(128) NULL, - PRINCIPAL_NAME varchar(128) NULL, - PRINCIPAL_TYPE varchar(128) NULL, - TBL_PRIV varchar(128) NULL, + GRANTOR nvarchar(128) NULL, + GRANTOR_TYPE nvarchar(128) NULL, + PRINCIPAL_NAME nvarchar(128) NULL, + PRINCIPAL_TYPE nvarchar(128) NULL, + TBL_PRIV nvarchar(128) NULL, TBL_ID bigint NULL ); @@ -270,11 +270,11 @@ ALTER TABLE TBL_PRIVS ADD CONSTRAINT TBL_PRIVS_PK PRIMARY KEY (TBL_GRANT_ID); CREATE TABLE DBS ( DB_ID bigint NOT NULL, - "DESC" varchar(4000) NULL, - DB_LOCATION_URI varchar(4000) NOT NULL, - "NAME" varchar(128) NULL, - OWNER_NAME varchar(128) NULL, - OWNER_TYPE varchar(10) NULL + "DESC" nvarchar(4000) NULL, + DB_LOCATION_URI nvarchar(4000) NOT NULL, + "NAME" nvarchar(128) NULL, + OWNER_NAME nvarchar(128) NULL, + OWNER_TYPE nvarchar(10) NULL ); ALTER TABLE DBS ADD CONSTRAINT DBS_PK PRIMARY KEY (DB_ID); @@ -283,14 +283,14 @@ ALTER TABLE DBS ADD CONSTRAINT DBS_PK PRIMARY KEY (DB_ID); CREATE TABLE TBL_COL_PRIVS ( TBL_COLUMN_GRANT_ID bigint NOT NULL, - "COLUMN_NAME" varchar(128) NULL, + "COLUMN_NAME" nvarchar(128) NULL, CREATE_TIME int NOT NULL, GRANT_OPTION smallint NOT NULL CHECK (GRANT_OPTION IN (0,1)), - GRANTOR varchar(128) NULL, - GRANTOR_TYPE varchar(128) NULL, - PRINCIPAL_NAME varchar(128) NULL, - PRINCIPAL_TYPE varchar(128) NULL, - TBL_COL_PRIV varchar(128) NULL, + GRANTOR nvarchar(128) NULL, + GRANTOR_TYPE nvarchar(128) NULL, + PRINCIPAL_NAME nvarchar(128) NULL, + PRINCIPAL_TYPE nvarchar(128) NULL, + TBL_COL_PRIV nvarchar(128) NULL, TBL_ID bigint NULL ); @@ -299,8 +299,8 @@ ALTER TABLE TBL_COL_PRIVS ADD CONSTRAINT TBL_COL_PRIVS_PK PRIMARY KEY (TBL_COLUM -- Table DELEGATION_TOKENS for classes [org.apache.hadoop.hive.metastore.model.MDelegationToken] CREATE TABLE DELEGATION_TOKENS ( - TOKEN_IDENT varchar(767) NOT NULL, - TOKEN varchar(767) NULL + TOKEN_IDENT nvarchar(767) NOT NULL, + TOKEN nvarchar(767) NULL ); ALTER TABLE DELEGATION_TOKENS ADD CONSTRAINT DELEGATION_TOKENS_PK PRIMARY KEY (TOKEN_IDENT); @@ -309,8 +309,8 @@ ALTER TABLE DELEGATION_TOKENS ADD CONSTRAINT DELEGATION_TOKENS_PK PRIMARY KEY (T CREATE TABLE SERDES ( SERDE_ID bigint NOT NULL, - "NAME" varchar(128) NULL, - SLIB varchar(4000) NULL + "NAME" nvarchar(128) NULL, + SLIB nvarchar(4000) NULL ); ALTER TABLE SERDES ADD CONSTRAINT SERDES_PK PRIMARY KEY (SERDE_ID); @@ -319,13 +319,13 @@ ALTER TABLE SERDES ADD CONSTRAINT SERDES_PK PRIMARY KEY (SERDE_ID); CREATE TABLE FUNCS ( FUNC_ID bigint NOT NULL, - CLASS_NAME varchar(4000) NULL, + CLASS_NAME nvarchar(4000) NULL, CREATE_TIME int NOT NULL, DB_ID bigint NULL, - FUNC_NAME varchar(128) NULL, + FUNC_NAME nvarchar(128) NULL, FUNC_TYPE int NOT NULL, - OWNER_NAME varchar(128) NULL, - OWNER_TYPE varchar(10) NULL + OWNER_NAME nvarchar(128) NULL, + OWNER_TYPE nvarchar(10) NULL ); ALTER TABLE FUNCS ADD CONSTRAINT FUNCS_PK PRIMARY KEY (FUNC_ID); @@ -336,10 +336,10 @@ CREATE TABLE ROLE_MAP ROLE_GRANT_ID bigint NOT NULL, ADD_TIME int NOT NULL, GRANT_OPTION smallint NOT NULL CHECK (GRANT_OPTION IN (0,1)), - GRANTOR varchar(128) NULL, - GRANTOR_TYPE varchar(128) NULL, - PRINCIPAL_NAME varchar(128) NULL, - PRINCIPAL_TYPE varchar(128) NULL, + GRANTOR nvarchar(128) NULL, + GRANTOR_TYPE nvarchar(128) NULL, + PRINCIPAL_NAME nvarchar(128) NULL, + PRINCIPAL_TYPE nvarchar(128) NULL, ROLE_ID bigint NULL ); @@ -352,11 +352,11 @@ CREATE TABLE TBLS CREATE_TIME int NOT NULL, DB_ID bigint NULL, LAST_ACCESS_TIME int NOT NULL, - OWNER varchar(767) NULL, + OWNER nvarchar(767) NULL, RETENTION int NOT NULL, SD_ID bigint NULL, - TBL_NAME varchar(128) NULL, - TBL_TYPE varchar(128) NULL, + TBL_NAME nvarchar(128) NULL, + TBL_TYPE nvarchar(128) NULL, VIEW_EXPANDED_TEXT text NULL, VIEW_ORIGINAL_TEXT text NULL ); @@ -368,12 +368,12 @@ CREATE TABLE SDS ( SD_ID bigint NOT NULL, CD_ID bigint NULL, - INPUT_FORMAT varchar(4000) NULL, + INPUT_FORMAT nvarchar(4000) NULL, IS_COMPRESSED bit NOT NULL, IS_STOREDASSUBDIRECTORIES bit NOT NULL, LOCATION nvarchar(4000) NULL, NUM_BUCKETS int NOT NULL, - OUTPUT_FORMAT varchar(4000) NULL, + OUTPUT_FORMAT nvarchar(4000) NULL, SERDE_ID bigint NULL ); @@ -383,11 +383,11 @@ ALTER TABLE SDS ADD CONSTRAINT SDS_PK PRIMARY KEY (SD_ID); CREATE TABLE PARTITION_EVENTS ( PART_NAME_ID bigint NOT NULL, - DB_NAME varchar(128) NULL, + DB_NAME nvarchar(128) NULL, EVENT_TIME bigint NOT NULL, EVENT_TYPE int NOT NULL, - PARTITION_NAME varchar(767) NULL, - TBL_NAME varchar(128) NULL + PARTITION_NAME nvarchar(767) NULL, + TBL_NAME nvarchar(128) NULL ); ALTER TABLE PARTITION_EVENTS ADD CONSTRAINT PARTITION_EVENTS_PK PRIMARY KEY (PART_NAME_ID); @@ -396,7 +396,7 @@ ALTER TABLE PARTITION_EVENTS ADD CONSTRAINT PARTITION_EVENTS_PK PRIMARY KEY (PAR CREATE TABLE SORT_COLS ( SD_ID bigint NOT NULL, - "COLUMN_NAME" varchar(128) NULL, + "COLUMN_NAME" nvarchar(128) NULL, "ORDER" int NOT NULL, INTEGER_IDX int NOT NULL ); @@ -407,7 +407,7 @@ ALTER TABLE SORT_COLS ADD CONSTRAINT SORT_COLS_PK PRIMARY KEY (SD_ID,INTEGER_IDX CREATE TABLE SKEWED_COL_NAMES ( SD_ID bigint NOT NULL, - SKEWED_COL_NAME varchar(255) NULL, + SKEWED_COL_NAME nvarchar(255) NULL, INTEGER_IDX int NOT NULL ); @@ -418,7 +418,7 @@ CREATE TABLE SKEWED_COL_VALUE_LOC_MAP ( SD_ID bigint NOT NULL, STRING_LIST_ID_KID bigint NOT NULL, - LOCATION varchar(4000) NULL + LOCATION nvarchar(4000) NULL ); ALTER TABLE SKEWED_COL_VALUE_LOC_MAP ADD CONSTRAINT SKEWED_COL_VALUE_LOC_MAP_PK PRIMARY KEY (SD_ID,STRING_LIST_ID_KID); @@ -427,7 +427,7 @@ ALTER TABLE SKEWED_COL_VALUE_LOC_MAP ADD CONSTRAINT SKEWED_COL_VALUE_LOC_MAP_PK CREATE TABLE SKEWED_STRING_LIST_VALUES ( STRING_LIST_ID bigint NOT NULL, - STRING_LIST_VALUE varchar(255) NULL, + STRING_LIST_VALUE nvarchar(255) NULL, INTEGER_IDX int NOT NULL ); @@ -447,9 +447,9 @@ ALTER TABLE PARTITION_KEY_VALS ADD CONSTRAINT PARTITION_KEY_VALS_PK PRIMARY KEY CREATE TABLE PARTITION_KEYS ( TBL_ID bigint NOT NULL, - PKEY_COMMENT varchar(4000) NULL, - PKEY_NAME varchar(128) NOT NULL, - PKEY_TYPE varchar(767) NOT NULL, + PKEY_COMMENT nvarchar(4000) NULL, + PKEY_NAME nvarchar(128) NOT NULL, + PKEY_TYPE nvarchar(767) NOT NULL, INTEGER_IDX int NOT NULL ); @@ -469,8 +469,8 @@ ALTER TABLE SKEWED_VALUES ADD CONSTRAINT SKEWED_VALUES_PK PRIMARY KEY (SD_ID_OID CREATE TABLE SD_PARAMS ( SD_ID bigint NOT NULL, - PARAM_KEY varchar(256) NOT NULL, - PARAM_VALUE varchar(4000) NULL + PARAM_KEY nvarchar(256) NOT NULL, + PARAM_VALUE nvarchar(4000) NULL ); ALTER TABLE SD_PARAMS ADD CONSTRAINT SD_PARAMS_PK PRIMARY KEY (SD_ID,PARAM_KEY); @@ -480,7 +480,7 @@ CREATE TABLE FUNC_RU ( FUNC_ID bigint NOT NULL, RESOURCE_TYPE int NOT NULL, - RESOURCE_URI varchar(4000) NULL, + RESOURCE_URI nvarchar(4000) NULL, INTEGER_IDX int NOT NULL ); @@ -490,9 +490,9 @@ ALTER TABLE FUNC_RU ADD CONSTRAINT FUNC_RU_PK PRIMARY KEY (FUNC_ID,INTEGER_IDX); CREATE TABLE TYPE_FIELDS ( TYPE_NAME bigint NOT NULL, - COMMENT varchar(256) NULL, - FIELD_NAME varchar(128) NOT NULL, - FIELD_TYPE varchar(767) NOT NULL, + COMMENT nvarchar(256) NULL, + FIELD_NAME nvarchar(128) NOT NULL, + FIELD_TYPE nvarchar(767) NOT NULL, INTEGER_IDX int NOT NULL ); @@ -502,7 +502,7 @@ ALTER TABLE TYPE_FIELDS ADD CONSTRAINT TYPE_FIELDS_PK PRIMARY KEY (TYPE_NAME,FIE CREATE TABLE BUCKETING_COLS ( SD_ID bigint NOT NULL, - BUCKET_COL_NAME varchar(255) NULL, + BUCKET_COL_NAME nvarchar(255) NULL, INTEGER_IDX int NOT NULL ); @@ -512,8 +512,8 @@ ALTER TABLE BUCKETING_COLS ADD CONSTRAINT BUCKETING_COLS_PK PRIMARY KEY (SD_ID,I CREATE TABLE DATABASE_PARAMS ( DB_ID bigint NOT NULL, - PARAM_KEY varchar(180) NOT NULL, - PARAM_VALUE varchar(4000) NULL + PARAM_KEY nvarchar(180) NOT NULL, + PARAM_VALUE nvarchar(4000) NULL ); ALTER TABLE DATABASE_PARAMS ADD CONSTRAINT DATABASE_PARAMS_PK PRIMARY KEY (DB_ID,PARAM_KEY); @@ -522,8 +522,8 @@ ALTER TABLE DATABASE_PARAMS ADD CONSTRAINT DATABASE_PARAMS_PK PRIMARY KEY (DB_ID CREATE TABLE INDEX_PARAMS ( INDEX_ID bigint NOT NULL, - PARAM_KEY varchar(256) NOT NULL, - PARAM_VALUE varchar(4000) NULL + PARAM_KEY nvarchar(256) NOT NULL, + PARAM_VALUE nvarchar(4000) NULL ); ALTER TABLE INDEX_PARAMS ADD CONSTRAINT INDEX_PARAMS_PK PRIMARY KEY (INDEX_ID,PARAM_KEY); @@ -532,9 +532,9 @@ ALTER TABLE INDEX_PARAMS ADD CONSTRAINT INDEX_PARAMS_PK PRIMARY KEY (INDEX_ID,PA CREATE TABLE COLUMNS_V2 ( CD_ID bigint NOT NULL, - COMMENT varchar(256) NULL, - "COLUMN_NAME" varchar(128) NOT NULL, - TYPE_NAME varchar(4000) NOT NULL, + COMMENT nvarchar(256) NULL, + "COLUMN_NAME" nvarchar(128) NOT NULL, + TYPE_NAME nvarchar(4000) NOT NULL, INTEGER_IDX int NOT NULL ); @@ -544,8 +544,8 @@ ALTER TABLE COLUMNS_V2 ADD CONSTRAINT COLUMNS_PK PRIMARY KEY (CD_ID,"COLUMN_NAME CREATE TABLE SERDE_PARAMS ( SERDE_ID bigint NOT NULL, - PARAM_KEY varchar(256) NOT NULL, - PARAM_VALUE varchar(4000) NULL + PARAM_KEY nvarchar(256) NOT NULL, + PARAM_VALUE nvarchar(4000) NULL ); ALTER TABLE SERDE_PARAMS ADD CONSTRAINT SERDE_PARAMS_PK PRIMARY KEY (SERDE_ID,PARAM_KEY); @@ -554,8 +554,8 @@ ALTER TABLE SERDE_PARAMS ADD CONSTRAINT SERDE_PARAMS_PK PRIMARY KEY (SERDE_ID,PA CREATE TABLE PARTITION_PARAMS ( PART_ID bigint NOT NULL, - PARAM_KEY varchar(256) NOT NULL, - PARAM_VALUE varchar(4000) NULL + PARAM_KEY nvarchar(256) NOT NULL, + PARAM_VALUE nvarchar(4000) NULL ); ALTER TABLE PARTITION_PARAMS ADD CONSTRAINT PARTITION_PARAMS_PK PRIMARY KEY (PART_ID,PARAM_KEY); @@ -564,8 +564,8 @@ ALTER TABLE PARTITION_PARAMS ADD CONSTRAINT PARTITION_PARAMS_PK PRIMARY KEY (PAR CREATE TABLE TABLE_PARAMS ( TBL_ID bigint NOT NULL, - PARAM_KEY varchar(256) NOT NULL, - PARAM_VALUE varchar(4000) NULL + PARAM_KEY nvarchar(256) NOT NULL, + PARAM_VALUE nvarchar(4000) NULL ); ALTER TABLE TABLE_PARAMS ADD CONSTRAINT TABLE_PARAMS_PK PRIMARY KEY (TBL_ID,PARAM_KEY); @@ -575,9 +575,9 @@ CREATE TABLE NOTIFICATION_LOG NL_ID bigint NOT NULL, EVENT_ID bigint NOT NULL, EVENT_TIME int NOT NULL, - EVENT_TYPE varchar(32) NOT NULL, - DB_NAME varchar(128) NULL, - TBL_NAME varchar(128) NULL, + EVENT_TYPE nvarchar(32) NOT NULL, + DB_NAME nvarchar(128) NULL, + TBL_NAME nvarchar(128) NULL, MESSAGE text NULL ); @@ -858,14 +858,14 @@ CREATE INDEX TABLE_PARAMS_N49 ON TABLE_PARAMS (TBL_ID); -- ----------------------------------------------------------------------------------------------------------------------------------------------- CREATE TABLE COMPACTION_QUEUE( CQ_ID bigint NOT NULL, - CQ_DATABASE varchar(128) NOT NULL, - CQ_TABLE varchar(128) NOT NULL, - CQ_PARTITION varchar(767) NULL, + CQ_DATABASE nvarchar(128) NOT NULL, + CQ_TABLE nvarchar(128) NOT NULL, + CQ_PARTITION nvarchar(767) NULL, CQ_STATE char(1) NOT NULL, CQ_TYPE char(1) NOT NULL, - CQ_WORKER_ID varchar(128) NULL, + CQ_WORKER_ID nvarchar(128) NULL, CQ_START bigint NULL, - CQ_RUN_AS varchar(128) NULL, + CQ_RUN_AS nvarchar(128) NULL, PRIMARY KEY CLUSTERED ( CQ_ID ASC @@ -874,24 +874,24 @@ PRIMARY KEY CLUSTERED CREATE TABLE COMPLETED_TXN_COMPONENTS( CTC_TXNID bigint NULL, - CTC_DATABASE varchar(128) NOT NULL, - CTC_TABLE varchar(128) NULL, - CTC_PARTITION varchar(767) NULL + CTC_DATABASE nvarchar(128) NOT NULL, + CTC_TABLE nvarchar(128) NULL, + CTC_PARTITION nvarchar(767) NULL ); CREATE TABLE HIVE_LOCKS( HL_LOCK_EXT_ID bigint NOT NULL, HL_LOCK_INT_ID bigint NOT NULL, HL_TXNID bigint NULL, - HL_DB varchar(128) NOT NULL, - HL_TABLE varchar(128) NULL, - HL_PARTITION varchar(767) NULL, + HL_DB nvarchar(128) NOT NULL, + HL_TABLE nvarchar(128) NULL, + HL_PARTITION nvarchar(767) NULL, HL_LOCK_STATE char(1) NOT NULL, HL_LOCK_TYPE char(1) NOT NULL, HL_LAST_HEARTBEAT bigint NOT NULL, HL_ACQUIRED_AT bigint NULL, - HL_USER varchar(128) NOT NULL, - HL_HOST varchar(128) NOT NULL, + HL_USER nvarchar(128) NOT NULL, + HL_HOST nvarchar(128) NOT NULL, PRIMARY KEY CLUSTERED ( HL_LOCK_EXT_ID ASC, @@ -922,8 +922,8 @@ CREATE TABLE TXNS( TXN_STATE char(1) NOT NULL, TXN_STARTED bigint NOT NULL, TXN_LAST_HEARTBEAT bigint NOT NULL, - TXN_USER varchar(128) NOT NULL, - TXN_HOST varchar(128) NOT NULL, + TXN_USER nvarchar(128) NOT NULL, + TXN_HOST nvarchar(128) NOT NULL, PRIMARY KEY CLUSTERED ( TXN_ID ASC @@ -932,9 +932,9 @@ PRIMARY KEY CLUSTERED CREATE TABLE TXN_COMPONENTS( TC_TXNID bigint NULL, - TC_DATABASE varchar(128) NOT NULL, - TC_TABLE varchar(128) NULL, - TC_PARTITION varchar(767) NULL + TC_DATABASE nvarchar(128) NOT NULL, + TC_TABLE nvarchar(128) NULL, + TC_PARTITION nvarchar(767) NULL ); ALTER TABLE TXN_COMPONENTS WITH CHECK ADD FOREIGN KEY(TC_TXNID) REFERENCES TXNS (TXN_ID); http://git-wip-us.apache.org/repos/asf/hive/blob/8c93f2ba/metastore/scripts/upgrade/mssql/hive-schema-1.3.0.mssql.sql ---------------------------------------------------------------------- diff --git a/metastore/scripts/upgrade/mssql/hive-schema-1.3.0.mssql.sql b/metastore/scripts/upgrade/mssql/hive-schema-1.3.0.mssql.sql index 723a185..7165edd 100644 --- a/metastore/scripts/upgrade/mssql/hive-schema-1.3.0.mssql.sql +++ b/metastore/scripts/upgrade/mssql/hive-schema-1.3.0.mssql.sql @@ -49,7 +49,7 @@ CREATE TABLE MASTER_KEYS ( KEY_ID int NOT NULL, - MASTER_KEY varchar(767) NULL + MASTER_KEY nvarchar(767) NULL ); ALTER TABLE MASTER_KEYS ADD CONSTRAINT MASTER_KEYS_PK PRIMARY KEY (KEY_ID); @@ -60,8 +60,8 @@ CREATE TABLE IDXS INDEX_ID bigint NOT NULL, CREATE_TIME int NOT NULL, DEFERRED_REBUILD bit NOT NULL, - INDEX_HANDLER_CLASS varchar(4000) NULL, - INDEX_NAME varchar(128) NULL, + INDEX_HANDLER_CLASS nvarchar(4000) NULL, + INDEX_NAME nvarchar(128) NULL, INDEX_TBL_ID bigint NULL, LAST_ACCESS_TIME int NOT NULL, ORIG_TBL_ID bigint NULL, @@ -75,11 +75,11 @@ CREATE TABLE PART_COL_STATS ( CS_ID bigint NOT NULL, AVG_COL_LEN float NULL, - "COLUMN_NAME" varchar(128) NOT NULL, - COLUMN_TYPE varchar(128) NOT NULL, - DB_NAME varchar(128) NOT NULL, - BIG_DECIMAL_HIGH_VALUE varchar(255) NULL, - BIG_DECIMAL_LOW_VALUE varchar(255) NULL, + "COLUMN_NAME" nvarchar(128) NOT NULL, + COLUMN_TYPE nvarchar(128) NOT NULL, + DB_NAME nvarchar(128) NOT NULL, + BIG_DECIMAL_HIGH_VALUE nvarchar(255) NULL, + BIG_DECIMAL_LOW_VALUE nvarchar(255) NULL, DOUBLE_HIGH_VALUE float NULL, DOUBLE_LOW_VALUE float NULL, LAST_ANALYZED bigint NOT NULL, @@ -91,8 +91,8 @@ CREATE TABLE PART_COL_STATS NUM_NULLS bigint NOT NULL, NUM_TRUES bigint NULL, PART_ID bigint NULL, - PARTITION_NAME varchar(767) NOT NULL, - "TABLE_NAME" varchar(128) NOT NULL + PARTITION_NAME nvarchar(767) NOT NULL, + "TABLE_NAME" nvarchar(128) NOT NULL ); ALTER TABLE PART_COL_STATS ADD CONSTRAINT PART_COL_STATS_PK PRIMARY KEY (CS_ID); @@ -105,12 +105,12 @@ CREATE TABLE PART_PRIVS PART_GRANT_ID bigint NOT NULL, CREATE_TIME int NOT NULL, GRANT_OPTION smallint NOT NULL CHECK (GRANT_OPTION IN (0,1)), - GRANTOR varchar(128) NULL, - GRANTOR_TYPE varchar(128) NULL, + GRANTOR nvarchar(128) NULL, + GRANTOR_TYPE nvarchar(128) NULL, PART_ID bigint NULL, - PRINCIPAL_NAME varchar(128) NULL, - PRINCIPAL_TYPE varchar(128) NULL, - PART_PRIV varchar(128) NULL + PRINCIPAL_NAME nvarchar(128) NULL, + PRINCIPAL_TYPE nvarchar(128) NULL, + PART_PRIV nvarchar(128) NULL ); ALTER TABLE PART_PRIVS ADD CONSTRAINT PART_PRIVS_PK PRIMARY KEY (PART_GRANT_ID); @@ -128,8 +128,8 @@ CREATE TABLE ROLES ( ROLE_ID bigint NOT NULL, CREATE_TIME int NOT NULL, - OWNER_NAME varchar(128) NULL, - ROLE_NAME varchar(128) NULL + OWNER_NAME nvarchar(128) NULL, + ROLE_NAME nvarchar(128) NULL ); ALTER TABLE ROLES ADD CONSTRAINT ROLES_PK PRIMARY KEY (ROLE_ID); @@ -159,8 +159,8 @@ ALTER TABLE CDS ADD CONSTRAINT CDS_PK PRIMARY KEY (CD_ID); CREATE TABLE VERSION ( VER_ID bigint NOT NULL, - SCHEMA_VERSION varchar(127) NOT NULL, - VERSION_COMMENT varchar(255) NOT NULL + SCHEMA_VERSION nvarchar(127) NOT NULL, + VERSION_COMMENT nvarchar(255) NOT NULL ); ALTER TABLE VERSION ADD CONSTRAINT VERSION_PK PRIMARY KEY (VER_ID); @@ -171,11 +171,11 @@ CREATE TABLE GLOBAL_PRIVS USER_GRANT_ID bigint NOT NULL, CREATE_TIME int NOT NULL, GRANT_OPTION smallint NOT NULL CHECK (GRANT_OPTION IN (0,1)), - GRANTOR varchar(128) NULL, - GRANTOR_TYPE varchar(128) NULL, - PRINCIPAL_NAME varchar(128) NULL, - PRINCIPAL_TYPE varchar(128) NULL, - USER_PRIV varchar(128) NULL + GRANTOR nvarchar(128) NULL, + GRANTOR_TYPE nvarchar(128) NULL, + PRINCIPAL_NAME nvarchar(128) NULL, + PRINCIPAL_TYPE nvarchar(128) NULL, + USER_PRIV nvarchar(128) NULL ); ALTER TABLE GLOBAL_PRIVS ADD CONSTRAINT GLOBAL_PRIVS_PK PRIMARY KEY (USER_GRANT_ID); @@ -184,15 +184,15 @@ ALTER TABLE GLOBAL_PRIVS ADD CONSTRAINT GLOBAL_PRIVS_PK PRIMARY KEY (USER_GRANT_ CREATE TABLE PART_COL_PRIVS ( PART_COLUMN_GRANT_ID bigint NOT NULL, - "COLUMN_NAME" varchar(128) NULL, + "COLUMN_NAME" nvarchar(128) NULL, CREATE_TIME int NOT NULL, GRANT_OPTION smallint NOT NULL CHECK (GRANT_OPTION IN (0,1)), - GRANTOR varchar(128) NULL, - GRANTOR_TYPE varchar(128) NULL, + GRANTOR nvarchar(128) NULL, + GRANTOR_TYPE nvarchar(128) NULL, PART_ID bigint NULL, - PRINCIPAL_NAME varchar(128) NULL, - PRINCIPAL_TYPE varchar(128) NULL, - PART_COL_PRIV varchar(128) NULL + PRINCIPAL_NAME nvarchar(128) NULL, + PRINCIPAL_TYPE nvarchar(128) NULL, + PART_COL_PRIV nvarchar(128) NULL ); ALTER TABLE PART_COL_PRIVS ADD CONSTRAINT PART_COL_PRIVS_PK PRIMARY KEY (PART_COLUMN_GRANT_ID); @@ -204,11 +204,11 @@ CREATE TABLE DB_PRIVS CREATE_TIME int NOT NULL, DB_ID bigint NULL, GRANT_OPTION smallint NOT NULL CHECK (GRANT_OPTION IN (0,1)), - GRANTOR varchar(128) NULL, - GRANTOR_TYPE varchar(128) NULL, - PRINCIPAL_NAME varchar(128) NULL, - PRINCIPAL_TYPE varchar(128) NULL, - DB_PRIV varchar(128) NULL + GRANTOR nvarchar(128) NULL, + GRANTOR_TYPE nvarchar(128) NULL, + PRINCIPAL_NAME nvarchar(128) NULL, + PRINCIPAL_TYPE nvarchar(128) NULL, + DB_PRIV nvarchar(128) NULL ); ALTER TABLE DB_PRIVS ADD CONSTRAINT DB_PRIVS_PK PRIMARY KEY (DB_GRANT_ID); @@ -218,11 +218,11 @@ CREATE TABLE TAB_COL_STATS ( CS_ID bigint NOT NULL, AVG_COL_LEN float NULL, - "COLUMN_NAME" varchar(128) NOT NULL, - COLUMN_TYPE varchar(128) NOT NULL, - DB_NAME varchar(128) NOT NULL, - BIG_DECIMAL_HIGH_VALUE varchar(255) NULL, - BIG_DECIMAL_LOW_VALUE varchar(255) NULL, + "COLUMN_NAME" nvarchar(128) NOT NULL, + COLUMN_TYPE nvarchar(128) NOT NULL, + DB_NAME nvarchar(128) NOT NULL, + BIG_DECIMAL_HIGH_VALUE nvarchar(255) NULL, + BIG_DECIMAL_LOW_VALUE nvarchar(255) NULL, DOUBLE_HIGH_VALUE float NULL, DOUBLE_LOW_VALUE float NULL, LAST_ANALYZED bigint NOT NULL, @@ -234,7 +234,7 @@ CREATE TABLE TAB_COL_STATS NUM_NULLS bigint NOT NULL, NUM_TRUES bigint NULL, TBL_ID bigint NULL, - "TABLE_NAME" varchar(128) NOT NULL + "TABLE_NAME" nvarchar(128) NOT NULL ); ALTER TABLE TAB_COL_STATS ADD CONSTRAINT TAB_COL_STATS_PK PRIMARY KEY (CS_ID); @@ -243,9 +243,9 @@ ALTER TABLE TAB_COL_STATS ADD CONSTRAINT TAB_COL_STATS_PK PRIMARY KEY (CS_ID); CREATE TABLE TYPES ( TYPES_ID bigint NOT NULL, - TYPE_NAME varchar(128) NULL, - TYPE1 varchar(767) NULL, - TYPE2 varchar(767) NULL + TYPE_NAME nvarchar(128) NULL, + TYPE1 nvarchar(767) NULL, + TYPE2 nvarchar(767) NULL ); ALTER TABLE TYPES ADD CONSTRAINT TYPES_PK PRIMARY KEY (TYPES_ID); @@ -256,11 +256,11 @@ CREATE TABLE TBL_PRIVS TBL_GRANT_ID bigint NOT NULL, CREATE_TIME int NOT NULL, GRANT_OPTION smallint NOT NULL CHECK (GRANT_OPTION IN (0,1)), - GRANTOR varchar(128) NULL, - GRANTOR_TYPE varchar(128) NULL, - PRINCIPAL_NAME varchar(128) NULL, - PRINCIPAL_TYPE varchar(128) NULL, - TBL_PRIV varchar(128) NULL, + GRANTOR nvarchar(128) NULL, + GRANTOR_TYPE nvarchar(128) NULL, + PRINCIPAL_NAME nvarchar(128) NULL, + PRINCIPAL_TYPE nvarchar(128) NULL, + TBL_PRIV nvarchar(128) NULL, TBL_ID bigint NULL ); @@ -270,11 +270,11 @@ ALTER TABLE TBL_PRIVS ADD CONSTRAINT TBL_PRIVS_PK PRIMARY KEY (TBL_GRANT_ID); CREATE TABLE DBS ( DB_ID bigint NOT NULL, - "DESC" varchar(4000) NULL, - DB_LOCATION_URI varchar(4000) NOT NULL, - "NAME" varchar(128) NULL, - OWNER_NAME varchar(128) NULL, - OWNER_TYPE varchar(10) NULL + "DESC" nvarchar(4000) NULL, + DB_LOCATION_URI nvarchar(4000) NOT NULL, + "NAME" nvarchar(128) NULL, + OWNER_NAME nvarchar(128) NULL, + OWNER_TYPE nvarchar(10) NULL ); ALTER TABLE DBS ADD CONSTRAINT DBS_PK PRIMARY KEY (DB_ID); @@ -283,14 +283,14 @@ ALTER TABLE DBS ADD CONSTRAINT DBS_PK PRIMARY KEY (DB_ID); CREATE TABLE TBL_COL_PRIVS ( TBL_COLUMN_GRANT_ID bigint NOT NULL, - "COLUMN_NAME" varchar(128) NULL, + "COLUMN_NAME" nvarchar(128) NULL, CREATE_TIME int NOT NULL, GRANT_OPTION smallint NOT NULL CHECK (GRANT_OPTION IN (0,1)), - GRANTOR varchar(128) NULL, - GRANTOR_TYPE varchar(128) NULL, - PRINCIPAL_NAME varchar(128) NULL, - PRINCIPAL_TYPE varchar(128) NULL, - TBL_COL_PRIV varchar(128) NULL, + GRANTOR nvarchar(128) NULL, + GRANTOR_TYPE nvarchar(128) NULL, + PRINCIPAL_NAME nvarchar(128) NULL, + PRINCIPAL_TYPE nvarchar(128) NULL, + TBL_COL_PRIV nvarchar(128) NULL, TBL_ID bigint NULL ); @@ -299,8 +299,8 @@ ALTER TABLE TBL_COL_PRIVS ADD CONSTRAINT TBL_COL_PRIVS_PK PRIMARY KEY (TBL_COLUM -- Table DELEGATION_TOKENS for classes [org.apache.hadoop.hive.metastore.model.MDelegationToken] CREATE TABLE DELEGATION_TOKENS ( - TOKEN_IDENT varchar(767) NOT NULL, - TOKEN varchar(767) NULL + TOKEN_IDENT nvarchar(767) NOT NULL, + TOKEN nvarchar(767) NULL ); ALTER TABLE DELEGATION_TOKENS ADD CONSTRAINT DELEGATION_TOKENS_PK PRIMARY KEY (TOKEN_IDENT); @@ -309,8 +309,8 @@ ALTER TABLE DELEGATION_TOKENS ADD CONSTRAINT DELEGATION_TOKENS_PK PRIMARY KEY (T CREATE TABLE SERDES ( SERDE_ID bigint NOT NULL, - "NAME" varchar(128) NULL, - SLIB varchar(4000) NULL + "NAME" nvarchar(128) NULL, + SLIB nvarchar(4000) NULL ); ALTER TABLE SERDES ADD CONSTRAINT SERDES_PK PRIMARY KEY (SERDE_ID); @@ -319,13 +319,13 @@ ALTER TABLE SERDES ADD CONSTRAINT SERDES_PK PRIMARY KEY (SERDE_ID); CREATE TABLE FUNCS ( FUNC_ID bigint NOT NULL, - CLASS_NAME varchar(4000) NULL, + CLASS_NAME nvarchar(4000) NULL, CREATE_TIME int NOT NULL, DB_ID bigint NULL, - FUNC_NAME varchar(128) NULL, + FUNC_NAME nvarchar(128) NULL, FUNC_TYPE int NOT NULL, - OWNER_NAME varchar(128) NULL, - OWNER_TYPE varchar(10) NULL + OWNER_NAME nvarchar(128) NULL, + OWNER_TYPE nvarchar(10) NULL ); ALTER TABLE FUNCS ADD CONSTRAINT FUNCS_PK PRIMARY KEY (FUNC_ID); @@ -336,10 +336,10 @@ CREATE TABLE ROLE_MAP ROLE_GRANT_ID bigint NOT NULL, ADD_TIME int NOT NULL, GRANT_OPTION smallint NOT NULL CHECK (GRANT_OPTION IN (0,1)), - GRANTOR varchar(128) NULL, - GRANTOR_TYPE varchar(128) NULL, - PRINCIPAL_NAME varchar(128) NULL, - PRINCIPAL_TYPE varchar(128) NULL, + GRANTOR nvarchar(128) NULL, + GRANTOR_TYPE nvarchar(128) NULL, + PRINCIPAL_NAME nvarchar(128) NULL, + PRINCIPAL_TYPE nvarchar(128) NULL, ROLE_ID bigint NULL ); @@ -352,11 +352,11 @@ CREATE TABLE TBLS CREATE_TIME int NOT NULL, DB_ID bigint NULL, LAST_ACCESS_TIME int NOT NULL, - OWNER varchar(767) NULL, + OWNER nvarchar(767) NULL, RETENTION int NOT NULL, SD_ID bigint NULL, - TBL_NAME varchar(128) NULL, - TBL_TYPE varchar(128) NULL, + TBL_NAME nvarchar(128) NULL, + TBL_TYPE nvarchar(128) NULL, VIEW_EXPANDED_TEXT text NULL, VIEW_ORIGINAL_TEXT text NULL ); @@ -368,12 +368,12 @@ CREATE TABLE SDS ( SD_ID bigint NOT NULL, CD_ID bigint NULL, - INPUT_FORMAT varchar(4000) NULL, + INPUT_FORMAT nvarchar(4000) NULL, IS_COMPRESSED bit NOT NULL, IS_STOREDASSUBDIRECTORIES bit NOT NULL, LOCATION nvarchar(4000) NULL, NUM_BUCKETS int NOT NULL, - OUTPUT_FORMAT varchar(4000) NULL, + OUTPUT_FORMAT nvarchar(4000) NULL, SERDE_ID bigint NULL ); @@ -383,11 +383,11 @@ ALTER TABLE SDS ADD CONSTRAINT SDS_PK PRIMARY KEY (SD_ID); CREATE TABLE PARTITION_EVENTS ( PART_NAME_ID bigint NOT NULL, - DB_NAME varchar(128) NULL, + DB_NAME nvarchar(128) NULL, EVENT_TIME bigint NOT NULL, EVENT_TYPE int NOT NULL, - PARTITION_NAME varchar(767) NULL, - TBL_NAME varchar(128) NULL + PARTITION_NAME nvarchar(767) NULL, + TBL_NAME nvarchar(128) NULL ); ALTER TABLE PARTITION_EVENTS ADD CONSTRAINT PARTITION_EVENTS_PK PRIMARY KEY (PART_NAME_ID); @@ -396,7 +396,7 @@ ALTER TABLE PARTITION_EVENTS ADD CONSTRAINT PARTITION_EVENTS_PK PRIMARY KEY (PAR CREATE TABLE SORT_COLS ( SD_ID bigint NOT NULL, - "COLUMN_NAME" varchar(128) NULL, + "COLUMN_NAME" nvarchar(128) NULL, "ORDER" int NOT NULL, INTEGER_IDX int NOT NULL ); @@ -407,7 +407,7 @@ ALTER TABLE SORT_COLS ADD CONSTRAINT SORT_COLS_PK PRIMARY KEY (SD_ID,INTEGER_IDX CREATE TABLE SKEWED_COL_NAMES ( SD_ID bigint NOT NULL, - SKEWED_COL_NAME varchar(255) NULL, + SKEWED_COL_NAME nvarchar(255) NULL, INTEGER_IDX int NOT NULL ); @@ -418,7 +418,7 @@ CREATE TABLE SKEWED_COL_VALUE_LOC_MAP ( SD_ID bigint NOT NULL, STRING_LIST_ID_KID bigint NOT NULL, - LOCATION varchar(4000) NULL + LOCATION nvarchar(4000) NULL ); ALTER TABLE SKEWED_COL_VALUE_LOC_MAP ADD CONSTRAINT SKEWED_COL_VALUE_LOC_MAP_PK PRIMARY KEY (SD_ID,STRING_LIST_ID_KID); @@ -427,7 +427,7 @@ ALTER TABLE SKEWED_COL_VALUE_LOC_MAP ADD CONSTRAINT SKEWED_COL_VALUE_LOC_MAP_PK CREATE TABLE SKEWED_STRING_LIST_VALUES ( STRING_LIST_ID bigint NOT NULL, - STRING_LIST_VALUE varchar(255) NULL, + STRING_LIST_VALUE nvarchar(255) NULL, INTEGER_IDX int NOT NULL ); @@ -447,9 +447,9 @@ ALTER TABLE PARTITION_KEY_VALS ADD CONSTRAINT PARTITION_KEY_VALS_PK PRIMARY KEY CREATE TABLE PARTITION_KEYS ( TBL_ID bigint NOT NULL, - PKEY_COMMENT varchar(4000) NULL, - PKEY_NAME varchar(128) NOT NULL, - PKEY_TYPE varchar(767) NOT NULL, + PKEY_COMMENT nvarchar(4000) NULL, + PKEY_NAME nvarchar(128) NOT NULL, + PKEY_TYPE nvarchar(767) NOT NULL, INTEGER_IDX int NOT NULL ); @@ -469,8 +469,8 @@ ALTER TABLE SKEWED_VALUES ADD CONSTRAINT SKEWED_VALUES_PK PRIMARY KEY (SD_ID_OID CREATE TABLE SD_PARAMS ( SD_ID bigint NOT NULL, - PARAM_KEY varchar(256) NOT NULL, - PARAM_VALUE varchar(4000) NULL + PARAM_KEY nvarchar(256) NOT NULL, + PARAM_VALUE nvarchar(4000) NULL ); ALTER TABLE SD_PARAMS ADD CONSTRAINT SD_PARAMS_PK PRIMARY KEY (SD_ID,PARAM_KEY); @@ -480,7 +480,7 @@ CREATE TABLE FUNC_RU ( FUNC_ID bigint NOT NULL, RESOURCE_TYPE int NOT NULL, - RESOURCE_URI varchar(4000) NULL, + RESOURCE_URI nvarchar(4000) NULL, INTEGER_IDX int NOT NULL ); @@ -490,9 +490,9 @@ ALTER TABLE FUNC_RU ADD CONSTRAINT FUNC_RU_PK PRIMARY KEY (FUNC_ID,INTEGER_IDX); CREATE TABLE TYPE_FIELDS ( TYPE_NAME bigint NOT NULL, - COMMENT varchar(256) NULL, - FIELD_NAME varchar(128) NOT NULL, - FIELD_TYPE varchar(767) NOT NULL, + COMMENT nvarchar(256) NULL, + FIELD_NAME nvarchar(128) NOT NULL, + FIELD_TYPE nvarchar(767) NOT NULL, INTEGER_IDX int NOT NULL ); @@ -502,7 +502,7 @@ ALTER TABLE TYPE_FIELDS ADD CONSTRAINT TYPE_FIELDS_PK PRIMARY KEY (TYPE_NAME,FIE CREATE TABLE BUCKETING_COLS ( SD_ID bigint NOT NULL, - BUCKET_COL_NAME varchar(255) NULL, + BUCKET_COL_NAME nvarchar(255) NULL, INTEGER_IDX int NOT NULL ); @@ -512,8 +512,8 @@ ALTER TABLE BUCKETING_COLS ADD CONSTRAINT BUCKETING_COLS_PK PRIMARY KEY (SD_ID,I CREATE TABLE DATABASE_PARAMS ( DB_ID bigint NOT NULL, - PARAM_KEY varchar(180) NOT NULL, - PARAM_VALUE varchar(4000) NULL + PARAM_KEY nvarchar(180) NOT NULL, + PARAM_VALUE nvarchar(4000) NULL ); ALTER TABLE DATABASE_PARAMS ADD CONSTRAINT DATABASE_PARAMS_PK PRIMARY KEY (DB_ID,PARAM_KEY); @@ -522,8 +522,8 @@ ALTER TABLE DATABASE_PARAMS ADD CONSTRAINT DATABASE_PARAMS_PK PRIMARY KEY (DB_ID CREATE TABLE INDEX_PARAMS ( INDEX_ID bigint NOT NULL, - PARAM_KEY varchar(256) NOT NULL, - PARAM_VALUE varchar(4000) NULL + PARAM_KEY nvarchar(256) NOT NULL, + PARAM_VALUE nvarchar(4000) NULL ); ALTER TABLE INDEX_PARAMS ADD CONSTRAINT INDEX_PARAMS_PK PRIMARY KEY (INDEX_ID,PARAM_KEY); @@ -532,9 +532,9 @@ ALTER TABLE INDEX_PARAMS ADD CONSTRAINT INDEX_PARAMS_PK PRIMARY KEY (INDEX_ID,PA CREATE TABLE COLUMNS_V2 ( CD_ID bigint NOT NULL, - COMMENT varchar(256) NULL, - "COLUMN_NAME" varchar(128) NOT NULL, - TYPE_NAME varchar(4000) NOT NULL, + COMMENT nvarchar(256) NULL, + "COLUMN_NAME" nvarchar(128) NOT NULL, + TYPE_NAME nvarchar(4000) NOT NULL, INTEGER_IDX int NOT NULL ); @@ -544,8 +544,8 @@ ALTER TABLE COLUMNS_V2 ADD CONSTRAINT COLUMNS_PK PRIMARY KEY (CD_ID,"COLUMN_NAME CREATE TABLE SERDE_PARAMS ( SERDE_ID bigint NOT NULL, - PARAM_KEY varchar(256) NOT NULL, - PARAM_VALUE varchar(4000) NULL + PARAM_KEY nvarchar(256) NOT NULL, + PARAM_VALUE nvarchar(4000) NULL ); ALTER TABLE SERDE_PARAMS ADD CONSTRAINT SERDE_PARAMS_PK PRIMARY KEY (SERDE_ID,PARAM_KEY); @@ -554,8 +554,8 @@ ALTER TABLE SERDE_PARAMS ADD CONSTRAINT SERDE_PARAMS_PK PRIMARY KEY (SERDE_ID,PA CREATE TABLE PARTITION_PARAMS ( PART_ID bigint NOT NULL, - PARAM_KEY varchar(256) NOT NULL, - PARAM_VALUE varchar(4000) NULL + PARAM_KEY nvarchar(256) NOT NULL, + PARAM_VALUE nvarchar(4000) NULL ); ALTER TABLE PARTITION_PARAMS ADD CONSTRAINT PARTITION_PARAMS_PK PRIMARY KEY (PART_ID,PARAM_KEY); @@ -564,8 +564,8 @@ ALTER TABLE PARTITION_PARAMS ADD CONSTRAINT PARTITION_PARAMS_PK PRIMARY KEY (PAR CREATE TABLE TABLE_PARAMS ( TBL_ID bigint NOT NULL, - PARAM_KEY varchar(256) NOT NULL, - PARAM_VALUE varchar(4000) NULL + PARAM_KEY nvarchar(256) NOT NULL, + PARAM_VALUE nvarchar(4000) NULL ); ALTER TABLE TABLE_PARAMS ADD CONSTRAINT TABLE_PARAMS_PK PRIMARY KEY (TBL_ID,PARAM_KEY); @@ -575,9 +575,9 @@ CREATE TABLE NOTIFICATION_LOG NL_ID bigint NOT NULL, EVENT_ID bigint NOT NULL, EVENT_TIME int NOT NULL, - EVENT_TYPE varchar(32) NOT NULL, - DB_NAME varchar(128) NULL, - TBL_NAME varchar(128) NULL, + EVENT_TYPE nvarchar(32) NOT NULL, + DB_NAME nvarchar(128) NULL, + TBL_NAME nvarchar(128) NULL, MESSAGE text NULL ); @@ -858,14 +858,14 @@ CREATE INDEX TABLE_PARAMS_N49 ON TABLE_PARAMS (TBL_ID); -- ----------------------------------------------------------------------------------------------------------------------------------------------- CREATE TABLE COMPACTION_QUEUE( CQ_ID bigint NOT NULL, - CQ_DATABASE varchar(128) NOT NULL, - CQ_TABLE varchar(128) NOT NULL, - CQ_PARTITION varchar(767) NULL, + CQ_DATABASE nvarchar(128) NOT NULL, + CQ_TABLE nvarchar(128) NOT NULL, + CQ_PARTITION nvarchar(767) NULL, CQ_STATE char(1) NOT NULL, CQ_TYPE char(1) NOT NULL, - CQ_WORKER_ID varchar(128) NULL, + CQ_WORKER_ID nvarchar(128) NULL, CQ_START bigint NULL, - CQ_RUN_AS varchar(128) NULL, + CQ_RUN_AS nvarchar(128) NULL, PRIMARY KEY CLUSTERED ( CQ_ID ASC @@ -874,24 +874,24 @@ PRIMARY KEY CLUSTERED CREATE TABLE COMPLETED_TXN_COMPONENTS( CTC_TXNID bigint NULL, - CTC_DATABASE varchar(128) NOT NULL, - CTC_TABLE varchar(128) NULL, - CTC_PARTITION varchar(767) NULL + CTC_DATABASE nvarchar(128) NOT NULL, + CTC_TABLE nvarchar(128) NULL, + CTC_PARTITION nvarchar(767) NULL ); CREATE TABLE HIVE_LOCKS( HL_LOCK_EXT_ID bigint NOT NULL, HL_LOCK_INT_ID bigint NOT NULL, HL_TXNID bigint NULL, - HL_DB varchar(128) NOT NULL, - HL_TABLE varchar(128) NULL, - HL_PARTITION varchar(767) NULL, + HL_DB nvarchar(128) NOT NULL, + HL_TABLE nvarchar(128) NULL, + HL_PARTITION nvarchar(767) NULL, HL_LOCK_STATE char(1) NOT NULL, HL_LOCK_TYPE char(1) NOT NULL, HL_LAST_HEARTBEAT bigint NOT NULL, HL_ACQUIRED_AT bigint NULL, - HL_USER varchar(128) NOT NULL, - HL_HOST varchar(128) NOT NULL, + HL_USER nvarchar(128) NOT NULL, + HL_HOST nvarchar(128) NOT NULL, PRIMARY KEY CLUSTERED ( HL_LOCK_EXT_ID ASC, @@ -922,8 +922,8 @@ CREATE TABLE TXNS( TXN_STATE char(1) NOT NULL, TXN_STARTED bigint NOT NULL, TXN_LAST_HEARTBEAT bigint NOT NULL, - TXN_USER varchar(128) NOT NULL, - TXN_HOST varchar(128) NOT NULL, + TXN_USER nvarchar(128) NOT NULL, + TXN_HOST nvarchar(128) NOT NULL, PRIMARY KEY CLUSTERED ( TXN_ID ASC @@ -932,9 +932,9 @@ PRIMARY KEY CLUSTERED CREATE TABLE TXN_COMPONENTS( TC_TXNID bigint NULL, - TC_DATABASE varchar(128) NOT NULL, - TC_TABLE varchar(128) NULL, - TC_PARTITION varchar(767) NULL + TC_DATABASE nvarchar(128) NOT NULL, + TC_TABLE nvarchar(128) NULL, + TC_PARTITION nvarchar(767) NULL ); ALTER TABLE TXN_COMPONENTS WITH CHECK ADD FOREIGN KEY(TC_TXNID) REFERENCES TXNS (TXN_ID); http://git-wip-us.apache.org/repos/asf/hive/blob/8c93f2ba/metastore/scripts/upgrade/mssql/upgrade-1.1.0-to-1.2.0.mssql.sql ---------------------------------------------------------------------- diff --git a/metastore/scripts/upgrade/mssql/upgrade-1.1.0-to-1.2.0.mssql.sql b/metastore/scripts/upgrade/mssql/upgrade-1.1.0-to-1.2.0.mssql.sql index 9e3bffb..9ff7d5c 100644 --- a/metastore/scripts/upgrade/mssql/upgrade-1.1.0-to-1.2.0.mssql.sql +++ b/metastore/scripts/upgrade/mssql/upgrade-1.1.0-to-1.2.0.mssql.sql @@ -1,5 +1,6 @@ SELECT 'Upgrading MetaStore schema from 1.1.0 to 1.2.0' AS MESSAGE; +:r 006-HIVE-9456.mssql.sql; UPDATE VERSION SET SCHEMA_VERSION='1.2.0', VERSION_COMMENT='Hive release version 1.2.0' where VER_ID=1; SELECT 'Finished upgrading MetaStore schema from 1.1.0 to 1.2.0' AS MESSAGE;