http://git-wip-us.apache.org/repos/asf/hive/blob/ba8a99e1/standalone-metastore/src/main/sql/mysql/upgrade-2.3.0-to-3.0.0.mysql.sql ---------------------------------------------------------------------- diff --git a/standalone-metastore/src/main/sql/mysql/upgrade-2.3.0-to-3.0.0.mysql.sql b/standalone-metastore/src/main/sql/mysql/upgrade-2.3.0-to-3.0.0.mysql.sql index 5a483ab..20f7c8d 100644 --- a/standalone-metastore/src/main/sql/mysql/upgrade-2.3.0-to-3.0.0.mysql.sql +++ b/standalone-metastore/src/main/sql/mysql/upgrade-2.3.0-to-3.0.0.mysql.sql @@ -129,6 +129,7 @@ CREATE TABLE `SCHEMA_VERSION` ( -- 048-HIVE-14498 CREATE TABLE IF NOT EXISTS `MV_CREATION_METADATA` ( `MV_CREATION_METADATA_ID` bigint(20) NOT NULL, + `CAT_NAME` varchar(256) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL, `DB_NAME` varchar(128) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL, `TBL_NAME` varchar(256) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL, `TXN_LIST` TEXT DEFAULT NULL, @@ -202,6 +203,62 @@ ALTER TABLE `KEY_CONSTRAINTS` ADD COLUMN `DEFAULT_VALUE` VARCHAR(400); ALTER TABLE `HIVE_LOCKS` CHANGE COLUMN `HL_TXNID` `HL_TXNID` bigint NOT NULL; +-- HIVE-18755, add catalogs +-- new catalogs table +CREATE TABLE `CTLGS` ( + `CTLG_ID` BIGINT PRIMARY KEY, + `NAME` VARCHAR(256), + `DESC` VARCHAR(4000), + `LOCATION_URI` VARCHAR(4000) NOT NULL, + UNIQUE KEY `UNIQUE_CATALOG` (`NAME`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +-- Insert a default value. The location is TBD. Hive will fix this when it starts +INSERT INTO `CTLGS` VALUES (1, 'hive', 'Default catalog for Hive', 'TBD'); + +-- Drop the unique index on DBS +ALTER TABLE `DBS` DROP KEY `UNIQUE_DATABASE`; + +-- Add the new column to the DBS table, can't put in the not null constraint yet +ALTER TABLE `DBS` ADD COLUMN `CTLG_NAME` VARCHAR(256); + +-- Update all records in the DBS table to point to the Hive catalog +UPDATE `DBS` + SET `CTLG_NAME` = 'hive'; + +-- Add the not null constraint +ALTER TABLE `DBS` CHANGE COLUMN `CTLG_NAME` `CTLG_NAME` varchar(256) NOT NULL; + +-- Put back the unique index +ALTER TABLE `DBS` ADD UNIQUE KEY `UNIQUE_DATABASE` (`NAME`, `CTLG_NAME`); + +-- Add the foreign key +ALTER TABLE `DBS` ADD CONSTRAINT `CTLG_FK1` FOREIGN KEY (`CTLG_NAME`) REFERENCES `CTLGS` (`NAME`); + +-- Add columns to table stats and part stats +ALTER TABLE `TAB_COL_STATS` ADD COLUMN `CAT_NAME` varchar(256); +ALTER TABLE `PART_COL_STATS` ADD COLUMN `CAT_NAME` varchar(256); + +-- Set the existing column names to Hive +UPDATE `TAB_COL_STATS` + SET `CAT_NAME` = 'hive'; +UPDATE `PART_COL_STATS` + SET `CAT_NAME` = 'hive'; + +-- Add the not null constraint +ALTER TABLE `TAB_COL_STATS` CHANGE COLUMN `CAT_NAME` `CAT_NAME` varchar(256) NOT NULL; +ALTER TABLE `PART_COL_STATS` CHANGE COLUMN `CAT_NAME` `CAT_NAME` varchar(256) NOT NULL; + +-- Rebuild the index for Part col stats. No such index for table stats, which seems weird +DROP INDEX `PCS_STATS_IDX` ON `PART_COL_STATS`; +CREATE INDEX `PCS_STATS_IDX` ON `PART_COL_STATS` (`CAT_NAME`, `DB_NAME`, `TABLE_NAME`, `COLUMN_NAME`, `PARTITION_NAME`); + +-- Add column to partition events +ALTER TABLE `PARTITION_EVENTS` ADD COLUMN `CAT_NAME` varchar(256); + +-- Add column to notification log +ALTER TABLE `NOTIFICATION_LOG` ADD COLUMN `CAT_NAME` varchar(256); + -- These lines need to be last. Insert any changes above. UPDATE VERSION SET SCHEMA_VERSION='3.0.0', VERSION_COMMENT='Hive release version 3.0.0' where VER_ID=1; SELECT 'Finished upgrading MetaStore schema from 2.3.0 to 3.0.0' AS ' ';
http://git-wip-us.apache.org/repos/asf/hive/blob/ba8a99e1/standalone-metastore/src/main/sql/oracle/hive-schema-3.0.0.oracle.sql ---------------------------------------------------------------------- diff --git a/standalone-metastore/src/main/sql/oracle/hive-schema-3.0.0.oracle.sql b/standalone-metastore/src/main/sql/oracle/hive-schema-3.0.0.oracle.sql index 09c40ad..755a8a8 100644 --- a/standalone-metastore/src/main/sql/oracle/hive-schema-3.0.0.oracle.sql +++ b/standalone-metastore/src/main/sql/oracle/hive-schema-3.0.0.oracle.sql @@ -72,6 +72,14 @@ CREATE TABLE PARTITION_KEY_VALS ALTER TABLE PARTITION_KEY_VALS ADD CONSTRAINT PARTITION_KEY_VALS_PK PRIMARY KEY (PART_ID,INTEGER_IDX); +CREATE TABLE CTLGS ( + CTLG_ID NUMBER PRIMARY KEY, + "NAME" VARCHAR2(256), + "DESC" VARCHAR2(4000), + LOCATION_URI VARCHAR2(4000) NOT NULL, + UNIQUE ("NAME") +); + -- Table DBS for classes [org.apache.hadoop.hive.metastore.model.MDatabase] CREATE TABLE DBS ( @@ -80,7 +88,8 @@ CREATE TABLE DBS DB_LOCATION_URI VARCHAR2(4000) NOT NULL, "NAME" VARCHAR2(128) NULL, OWNER_NAME VARCHAR2(128) NULL, - OWNER_TYPE VARCHAR2(10) NULL + OWNER_TYPE VARCHAR2(10) NULL, + CTLG_NAME VARCHAR2(256) ); ALTER TABLE DBS ADD CONSTRAINT DBS_PK PRIMARY KEY (DB_ID); @@ -389,6 +398,7 @@ ALTER TABLE TBLS ADD CONSTRAINT TBLS_PK PRIMARY KEY (TBL_ID); CREATE TABLE MV_CREATION_METADATA ( MV_CREATION_METADATA_ID NUMBER NOT NULL, + CAT_NAME VARCHAR2(256) NOT NULL, DB_NAME VARCHAR2(128) NOT NULL, TBL_NAME VARCHAR2(256) NOT NULL, TXN_LIST CLOB NULL @@ -409,6 +419,7 @@ CREATE TABLE MV_TABLES_USED CREATE TABLE PARTITION_EVENTS ( PART_NAME_ID NUMBER NOT NULL, + CAT_NAME VARCHAR2(256) NULL, DB_NAME VARCHAR2(128) NULL, EVENT_TIME NUMBER NOT NULL, EVENT_TYPE NUMBER (10) NOT NULL, @@ -486,10 +497,13 @@ ALTER TABLE SKEWED_VALUES ADD CONSTRAINT SKEWED_VALUES_FK1 FOREIGN KEY (STRING_L ALTER TABLE SKEWED_VALUES ADD CONSTRAINT SKEWED_VALUES_FK2 FOREIGN KEY (SD_ID_OID) REFERENCES SDS (SD_ID) INITIALLY DEFERRED ; +ALTER TABLE DBS ADD CONSTRAINT CTLGS_FK FOREIGN KEY (CTLG_NAME) REFERENCES CTLGS ("NAME") INITIALLY DEFERRED; + -- column statistics CREATE TABLE TAB_COL_STATS ( CS_ID NUMBER NOT NULL, + CAT_NAME VARCHAR2(256) NOT NULL, DB_NAME VARCHAR2(128) NOT NULL, TABLE_NAME VARCHAR2(256) NOT NULL, COLUMN_NAME VARCHAR2(767) NOT NULL, @@ -526,6 +540,7 @@ CREATE INDEX TAB_COL_STATS_N49 ON TAB_COL_STATS(TBL_ID); CREATE TABLE PART_COL_STATS ( CS_ID NUMBER NOT NULL, + CAT_NAME VARCHAR2(256) NOT NULL, DB_NAME VARCHAR2(128) NOT NULL, TABLE_NAME VARCHAR2(256) NOT NULL, PARTITION_NAME VARCHAR2(767) NOT NULL, @@ -554,7 +569,7 @@ ALTER TABLE PART_COL_STATS ADD CONSTRAINT PART_COL_STATS_FK FOREIGN KEY (PART_ID CREATE INDEX PART_COL_STATS_N49 ON PART_COL_STATS (PART_ID); -CREATE INDEX PCS_STATS_IDX ON PART_COL_STATS (DB_NAME,TABLE_NAME,COLUMN_NAME,PARTITION_NAME); +CREATE INDEX PCS_STATS_IDX ON PART_COL_STATS (CAT_NAME, DB_NAME,TABLE_NAME,COLUMN_NAME,PARTITION_NAME); CREATE TABLE FUNCS ( FUNC_ID NUMBER NOT NULL, @@ -584,6 +599,7 @@ CREATE TABLE NOTIFICATION_LOG EVENT_ID NUMBER NOT NULL, EVENT_TIME NUMBER(10) NOT NULL, EVENT_TYPE VARCHAR2(32) NOT NULL, + CAT_NAME VARCHAR2(256), DB_NAME VARCHAR2(128), TBL_NAME VARCHAR2(256), MESSAGE CLOB NULL, @@ -678,7 +694,7 @@ CREATE INDEX PARTITION_KEY_VALS_N49 ON PARTITION_KEY_VALS (PART_ID); -- Constraints for table DBS for class(es) [org.apache.hadoop.hive.metastore.model.MDatabase] -CREATE UNIQUE INDEX UNIQUE_DATABASE ON DBS ("NAME"); +CREATE UNIQUE INDEX UNIQUE_DATABASE ON DBS ("NAME", CTLG_NAME); -- Constraints for table PARTITION_PARAMS http://git-wip-us.apache.org/repos/asf/hive/blob/ba8a99e1/standalone-metastore/src/main/sql/oracle/upgrade-2.3.0-to-3.0.0.oracle.sql ---------------------------------------------------------------------- diff --git a/standalone-metastore/src/main/sql/oracle/upgrade-2.3.0-to-3.0.0.oracle.sql b/standalone-metastore/src/main/sql/oracle/upgrade-2.3.0-to-3.0.0.oracle.sql index f95819e..cd94c01 100644 --- a/standalone-metastore/src/main/sql/oracle/upgrade-2.3.0-to-3.0.0.oracle.sql +++ b/standalone-metastore/src/main/sql/oracle/upgrade-2.3.0-to-3.0.0.oracle.sql @@ -142,6 +142,7 @@ CREATE TABLE "SCHEMA_VERSION" ( CREATE TABLE MV_CREATION_METADATA ( MV_CREATION_METADATA_ID NUMBER NOT NULL, + CAT_NAME VARCHAR2(256) NOT NULL, DB_NAME VARCHAR2(128) NOT NULL, TBL_NAME VARCHAR2(256) NOT NULL, TXN_LIST CLOB NULL @@ -188,7 +189,6 @@ UPDATE DBS SET DB_LOCATION_URI = 's3a' || SUBSTR(DB_LOCATION_URI, 4) WHERE DB_LOCATION_URI LIKE 's3n://%' ; - -- HIVE-18192 CREATE TABLE TXN_TO_WRITE_ID ( T2W_TXNID number(19) NOT NULL, @@ -222,6 +222,62 @@ ALTER TABLE KEY_CONSTRAINTS ADD DEFAULT_VALUE VARCHAR(400); ALTER TABLE HIVE_LOCKS MODIFY(HL_TXNID NOT NULL); +-- HIVE-18755, add catalogs +-- new catalogs table +CREATE TABLE CTLGS ( + CTLG_ID NUMBER PRIMARY KEY, + "NAME" VARCHAR2(256), + "DESC" VARCHAR2(4000), + LOCATION_URI VARCHAR2(4000) NOT NULL, + UNIQUE ("NAME") +); + +-- Insert a default value. The location is TBD. Hive will fix this when it starts +INSERT INTO CTLGS VALUES (1, 'hive', 'Default catalog for Hive', 'TBD'); + +-- Drop the unique index on DBS +DROP INDEX UNIQUE_DATABASE; + +-- Add the new column to the DBS table, can't put in the not null constraint yet +ALTER TABLE DBS ADD CTLG_NAME VARCHAR2(256); + +-- Update all records in the DBS table to point to the Hive catalog +UPDATE DBS + SET "CTLG_NAME" = 'hive'; + +-- Add the not null constraint +ALTER TABLE DBS MODIFY CTLG_NAME NOT NULL; + +-- Put back the unique index +CREATE UNIQUE INDEX UNIQUE_DATABASE ON DBS ("NAME", CTLG_NAME); + +-- Add the foreign key +ALTER TABLE DBS ADD CONSTRAINT CTLGS_FK FOREIGN KEY (CTLG_NAME) REFERENCES CTLGS ("NAME") INITIALLY DEFERRED; + +-- Add columns to table stats and part stats +ALTER TABLE TAB_COL_STATS ADD CAT_NAME VARCHAR2(256); +ALTER TABLE PART_COL_STATS ADD CAT_NAME VARCHAR2(256); + +-- Set the existing column names to Hive +UPDATE TAB_COL_STATS + SET CAT_NAME = 'hive'; +UPDATE PART_COL_STATS + SET CAT_NAME = 'hive'; + +-- Add the not null constraint +ALTER TABLE TAB_COL_STATS MODIFY CAT_NAME NOT NULL; +ALTER TABLE PART_COL_STATS MODIFY CAT_NAME NOT NULL; + +-- Rebuild the index for Part col stats. No such index for table stats, which seems weird +DROP INDEX PCS_STATS_IDX; +CREATE INDEX PCS_STATS_IDX ON PART_COL_STATS (CAT_NAME, DB_NAME,TABLE_NAME,COLUMN_NAME,PARTITION_NAME); + +-- Add column to partition events +ALTER TABLE PARTITION_EVENTS ADD CAT_NAME VARCHAR2(256); + +-- Add column to notification log +ALTER TABLE NOTIFICATION_LOG ADD CAT_NAME VARCHAR2(256); + -- These lines need to be last. Insert any changes above. UPDATE VERSION SET SCHEMA_VERSION='3.0.0', VERSION_COMMENT='Hive release version 3.0.0' where VER_ID=1; SELECT 'Finished upgrading MetaStore schema from 2.3.0 to 3.0.0' AS Status from dual; http://git-wip-us.apache.org/repos/asf/hive/blob/ba8a99e1/standalone-metastore/src/main/sql/postgres/hive-schema-3.0.0.postgres.sql ---------------------------------------------------------------------- diff --git a/standalone-metastore/src/main/sql/postgres/hive-schema-3.0.0.postgres.sql b/standalone-metastore/src/main/sql/postgres/hive-schema-3.0.0.postgres.sql index 69317b0..72e5966 100644 --- a/standalone-metastore/src/main/sql/postgres/hive-schema-3.0.0.postgres.sql +++ b/standalone-metastore/src/main/sql/postgres/hive-schema-3.0.0.postgres.sql @@ -59,6 +59,13 @@ CREATE TABLE "DATABASE_PARAMS" ( ); +CREATE TABLE "CTLGS" ( + "CTLG_ID" BIGINT PRIMARY KEY, + "NAME" VARCHAR(256) UNIQUE, + "DESC" VARCHAR(4000), + "LOCATION_URI" VARCHAR(4000) NOT NULL +); + -- -- Name: DBS; Type: TABLE; Schema: public; Owner: hiveuser; Tablespace: -- @@ -69,7 +76,8 @@ CREATE TABLE "DBS" ( "DB_LOCATION_URI" character varying(4000) NOT NULL, "NAME" character varying(128) DEFAULT NULL::character varying, "OWNER_NAME" character varying(128) DEFAULT NULL::character varying, - "OWNER_TYPE" character varying(10) DEFAULT NULL::character varying + "OWNER_TYPE" character varying(10) DEFAULT NULL::character varying, + "CTLG_NAME" varchar(256) ); @@ -168,6 +176,7 @@ CREATE TABLE "PARTITIONS" ( CREATE TABLE "PARTITION_EVENTS" ( "PART_NAME_ID" bigint NOT NULL, + "CAT_NAME" character varying(256), "DB_NAME" character varying(128), "EVENT_TIME" bigint NOT NULL, "EVENT_TYPE" integer NOT NULL, @@ -386,6 +395,7 @@ CREATE TABLE "TBLS" ( CREATE TABLE "MV_CREATION_METADATA" ( "MV_CREATION_METADATA_ID" bigint NOT NULL, + "CAT_NAME" character varying(256) NOT NULL, "DB_NAME" character varying(128) NOT NULL, "TBL_NAME" character varying(256) NOT NULL, "TXN_LIST" text @@ -508,6 +518,7 @@ CREATE TABLE "DELEGATION_TOKENS" CREATE TABLE "TAB_COL_STATS" ( "CS_ID" bigint NOT NULL, + "CAT_NAME" character varying(256) DEFAULT NULL::character varying, "DB_NAME" character varying(128) DEFAULT NULL::character varying, "TABLE_NAME" character varying(256) DEFAULT NULL::character varying, "COLUMN_NAME" character varying(767) DEFAULT NULL::character varying, @@ -544,6 +555,7 @@ CREATE TABLE "VERSION" ( CREATE TABLE "PART_COL_STATS" ( "CS_ID" bigint NOT NULL, + "CAT_NAME" character varying(256) DEFAULT NULL::character varying, "DB_NAME" character varying(128) DEFAULT NULL::character varying, "TABLE_NAME" character varying(256) DEFAULT NULL::character varying, "PARTITION_NAME" character varying(767) DEFAULT NULL::character varying, @@ -598,6 +610,7 @@ CREATE TABLE "NOTIFICATION_LOG" "EVENT_ID" BIGINT NOT NULL, "EVENT_TIME" INTEGER NOT NULL, "EVENT_TYPE" VARCHAR(32) NOT NULL, + "CAT_NAME" VARCHAR(256), "DB_NAME" VARCHAR(128), "TBL_NAME" VARCHAR(256), "MESSAGE" text, @@ -1182,7 +1195,7 @@ CREATE INDEX "PART_PRIVS_N49" ON "PART_PRIVS" USING btree ("PART_ID"); -- Name: PCS_STATS_IDX; Type: INDEX; Schema: public; Owner: hiveuser; Tablespace: -- -CREATE INDEX "PCS_STATS_IDX" ON "PART_COL_STATS" USING btree ("DB_NAME","TABLE_NAME","COLUMN_NAME","PARTITION_NAME"); +CREATE INDEX "PCS_STATS_IDX" ON "PART_COL_STATS" USING btree ("CAT_NAME", "DB_NAME","TABLE_NAME","COLUMN_NAME","PARTITION_NAME"); -- @@ -1556,6 +1569,7 @@ ALTER TABLE ONLY "TAB_COL_STATS" ADD CONSTRAINT "TAB_COL_STATS_fkey" FOREIGN KEY -- ALTER TABLE ONLY "PART_COL_STATS" ADD CONSTRAINT "PART_COL_STATS_fkey" FOREIGN KEY("PART_ID") REFERENCES "PARTITIONS"("PART_ID") DEFERRABLE; +ALTER TABLE "DBS" ADD CONSTRAINT "DBS_FK1" FOREIGN KEY ("CTLG_NAME") REFERENCES "CTLGS" ("NAME"); ALTER TABLE ONLY "VERSION" ADD CONSTRAINT "VERSION_pkey" PRIMARY KEY ("VER_ID"); http://git-wip-us.apache.org/repos/asf/hive/blob/ba8a99e1/standalone-metastore/src/main/sql/postgres/upgrade-2.3.0-to-3.0.0.postgres.sql ---------------------------------------------------------------------- diff --git a/standalone-metastore/src/main/sql/postgres/upgrade-2.3.0-to-3.0.0.postgres.sql b/standalone-metastore/src/main/sql/postgres/upgrade-2.3.0-to-3.0.0.postgres.sql index f7d8c73..7b4bd68 100644 --- a/standalone-metastore/src/main/sql/postgres/upgrade-2.3.0-to-3.0.0.postgres.sql +++ b/standalone-metastore/src/main/sql/postgres/upgrade-2.3.0-to-3.0.0.postgres.sql @@ -155,6 +155,7 @@ CREATE TABLE "SCHEMA_VERSION" ( -- 047-HIVE-14498 CREATE TABLE "MV_CREATION_METADATA" ( "MV_CREATION_METADATA_ID" bigint NOT NULL, + "CAT_NAME" character varying(256) NOT NULL, "DB_NAME" character varying(128) NOT NULL, "TBL_NAME" character varying(256) NOT NULL, "TXN_LIST" text @@ -237,6 +238,61 @@ ALTER TABLE "KEY_CONSTRAINTS" ADD COLUMN "DEFAULT_VALUE" VARCHAR(400); ALTER TABLE HIVE_LOCKS ALTER COLUMN HL_TXNID SET NOT NULL; +-- HIVE-18755, add catalogs +-- new catalogs table +CREATE TABLE "CTLGS" ( + "CTLG_ID" BIGINT PRIMARY KEY, + "NAME" VARCHAR(256) UNIQUE, + "DESC" VARCHAR(4000), + "LOCATION_URI" VARCHAR(4000) NOT NULL +); + +-- Insert a default value. The location is TBD. Hive will fix this when it starts +INSERT INTO "CTLGS" VALUES (1, 'hive', 'Default catalog for Hive', 'TBD'); + +-- Drop the unique index on DBS +ALTER TABLE "DBS" DROP CONSTRAINT "UNIQUE_DATABASE"; + +-- Add the new column to the DBS table, can't put in the not null constraint yet +ALTER TABLE "DBS" ADD "CTLG_NAME" VARCHAR(256); + +-- Update all records in the DBS table to point to the Hive catalog +UPDATE "DBS" + SET "CTLG_NAME" = 'hive'; + +-- Add the not null constraint +ALTER TABLE "DBS" ALTER COLUMN "CTLG_NAME" SET NOT NULL; + +-- Put back the unique index +ALTER TABLE "DBS" ADD CONSTRAINT "UNIQUE_DATABASE" UNIQUE ("NAME", "CTLG_NAME"); + +-- Add the foreign key +ALTER TABLE "DBS" ADD CONSTRAINT "DBS_FK1" FOREIGN KEY ("CTLG_NAME") REFERENCES "CTLGS" ("NAME"); + +-- Add columns to table stats and part stats +ALTER TABLE "TAB_COL_STATS" ADD "CAT_NAME" varchar(256); +ALTER TABLE "PART_COL_STATS" ADD "CAT_NAME" varchar(256); + +-- Set the existing column names to Hive +UPDATE "TAB_COL_STATS" + SET "CAT_NAME" = 'hive'; +UPDATE "PART_COL_STATS" + SET "CAT_NAME" = 'hive'; + +-- Add the not null constraint +ALTER TABLE "TAB_COL_STATS" ALTER COLUMN "CAT_NAME" SET NOT NULL; +ALTER TABLE "PART_COL_STATS" ALTER COLUMN "CAT_NAME" SET NOT NULL; + +-- Rebuild the index for Part col stats. No such index for table stats, which seems weird +DROP INDEX "PCS_STATS_IDX"; +CREATE INDEX "PCS_STATS_IDX" ON "PART_COL_STATS" ("CAT_NAME", "DB_NAME", "TABLE_NAME", "COLUMN_NAME", "PARTITION_NAME"); + +-- Add column to partition event +ALTER TABLE "PARTITION_EVENTS" ADD "CAT_NAME" varchar(256); + +-- Add column to notification log +ALTER TABLE "NOTIFICATION_LOG" ADD "CAT_NAME" varchar(256); + -- These lines need to be last. Insert any changes above. UPDATE "VERSION" SET "SCHEMA_VERSION"='3.0.0', "VERSION_COMMENT"='Hive release version 3.0.0' where "VER_ID"=1; SELECT 'Finished upgrading MetaStore schema from 2.3.0 to 3.0.0'; http://git-wip-us.apache.org/repos/asf/hive/blob/ba8a99e1/standalone-metastore/src/main/thrift/hive_metastore.thrift ---------------------------------------------------------------------- diff --git a/standalone-metastore/src/main/thrift/hive_metastore.thrift b/standalone-metastore/src/main/thrift/hive_metastore.thrift index 68d7b45..27917f0 100644 --- a/standalone-metastore/src/main/thrift/hive_metastore.thrift +++ b/standalone-metastore/src/main/thrift/hive_metastore.thrift @@ -48,8 +48,9 @@ struct SQLPrimaryKey { 4: i32 key_seq, // sequence number within primary key 5: string pk_name, // primary key name 6: bool enable_cstr, // Enable/Disable - 7: bool validate_cstr, // Validate/No validate - 8: bool rely_cstr // Rely/No Rely + 7: bool validate_cstr, // Validate/No validate + 8: bool rely_cstr, // Rely/No Rely + 9: optional string catName } struct SQLForeignKey { @@ -66,50 +67,55 @@ struct SQLForeignKey { 11: string pk_name, // primary key name 12: bool enable_cstr, // Enable/Disable 13: bool validate_cstr, // Validate/No validate - 14: bool rely_cstr // Rely/No Rely + 14: bool rely_cstr, // Rely/No Rely + 15: optional string catName } struct SQLUniqueConstraint { - 1: string table_db, // table schema - 2: string table_name, // table name - 3: string column_name, // column name - 4: i32 key_seq, // sequence number within unique constraint - 5: string uk_name, // unique key name - 6: bool enable_cstr, // Enable/Disable - 7: bool validate_cstr, // Validate/No validate - 8: bool rely_cstr // Rely/No Rely + 1: string catName, // table catalog + 2: string table_db, // table schema + 3: string table_name, // table name + 4: string column_name, // column name + 5: i32 key_seq, // sequence number within unique constraint + 6: string uk_name, // unique key name + 7: bool enable_cstr, // Enable/Disable + 8: bool validate_cstr, // Validate/No validate + 9: bool rely_cstr, // Rely/No Rely } struct SQLNotNullConstraint { - 1: string table_db, // table schema - 2: string table_name, // table name - 3: string column_name, // column name - 4: string nn_name, // not null name - 5: bool enable_cstr, // Enable/Disable - 6: bool validate_cstr, // Validate/No validate - 7: bool rely_cstr // Rely/No Rely + 1: string catName, // table catalog + 2: string table_db, // table schema + 3: string table_name, // table name + 4: string column_name, // column name + 5: string nn_name, // not null name + 6: bool enable_cstr, // Enable/Disable + 7: bool validate_cstr, // Validate/No validate + 8: bool rely_cstr, // Rely/No Rely } struct SQLDefaultConstraint { - 1: string table_db, // table schema - 2: string table_name, // table name - 3: string column_name, // column name - 4: string default_value,// default value - 5: string dc_name, // default name - 6: bool enable_cstr, // Enable/Disable - 7: bool validate_cstr, // Validate/No validate - 8: bool rely_cstr // Rely/No Rely + 1: string catName, // catalog name + 2: string table_db, // table schema + 3: string table_name, // table name + 4: string column_name, // column name + 5: string default_value,// default value + 6: string dc_name, // default name + 7: bool enable_cstr, // Enable/Disable + 8: bool validate_cstr, // Validate/No validate + 9: bool rely_cstr // Rely/No Rely } struct SQLCheckConstraint { - 1: string table_db, // table schema - 2: string table_name, // table name - 3: string column_name, // column name - 4: string check_expression,// check expression - 5: string dc_name, // default name - 6: bool enable_cstr, // Enable/Disable - 7: bool validate_cstr, // Validate/No validate - 8: bool rely_cstr // Rely/No Rely + 1: string catName, // catalog name + 2: string table_db, // table schema + 3: string table_name, // table name + 4: string column_name, // column name + 5: string check_expression,// check expression + 6: string dc_name, // default name + 7: bool enable_cstr, // Enable/Disable + 8: bool validate_cstr, // Validate/No validate + 9: bool rely_cstr // Rely/No Rely } struct Type { @@ -233,6 +239,7 @@ struct HiveObjectRef{ 3: string objectName, 4: list<string> partValues, 5: string columnName, + 6: optional string catName } struct PrivilegeGrantInfo { @@ -318,6 +325,34 @@ struct GrantRevokeRoleResponse { 1: optional bool success; } +struct Catalog { + 1: string name, // Name of the catalog + 2: optional string description, // description of the catalog + 3: string locationUri // default storage location. When databases are created in + // this catalog, if they do not specify a location, they will + // be placed in this location. +} + +struct CreateCatalogRequest { + 1: Catalog catalog +} + +struct GetCatalogRequest { + 1: string name +} + +struct GetCatalogResponse { + 1: Catalog catalog +} + +struct GetCatalogsResponse { + 1: list<string> names +} + +struct DropCatalogRequest { + 1: string name +} + // namespace for tables struct Database { 1: string name, @@ -326,7 +361,8 @@ struct Database { 4: map<string, string> parameters, // properties associated with the database 5: optional PrincipalPrivilegeSet privileges, 6: optional string ownerName, - 7: optional PrincipalType ownerType + 7: optional PrincipalType ownerType, + 8: optional string catalogName } // This object holds the information needed by SerDes @@ -386,7 +422,8 @@ struct Table { 13: optional PrincipalPrivilegeSet privileges, 14: optional bool temporary=false, 15: optional bool rewriteEnabled, // rewrite enabled or not - 16: optional CreationMetadata creationMetadata // only for MVs, it stores table names used and txn list at MV creation + 16: optional CreationMetadata creationMetadata, // only for MVs, it stores table names used and txn list at MV creation + 17: optional string catName // Name of the catalog the table is in } struct Partition { @@ -397,7 +434,8 @@ struct Partition { 5: i32 lastAccessTime, 6: StorageDescriptor sd, 7: map<string, string> parameters, - 8: optional PrincipalPrivilegeSet privileges + 8: optional PrincipalPrivilegeSet privileges, + 9: optional string catName } struct PartitionWithoutSD { @@ -423,7 +461,8 @@ struct PartitionSpec { 2: string tableName, 3: string rootPath, 4: optional PartitionSpecWithSharedSD sharedSDPartitionSpec, - 5: optional PartitionListComposingSpec partitionList + 5: optional PartitionListComposingSpec partitionList, + 6: optional string catName } // column statistics @@ -512,7 +551,8 @@ struct ColumnStatisticsDesc { 2: required string dbName, 3: required string tableName, 4: optional string partName, -5: optional i64 lastAnalyzed +5: optional i64 lastAnalyzed, +6: optional string catName } struct ColumnStatistics { @@ -547,7 +587,8 @@ struct EnvironmentContext { struct PrimaryKeysRequest { 1: required string db_name, - 2: required string tbl_name + 2: required string tbl_name, + 3: optional string catName } struct PrimaryKeysResponse { @@ -559,6 +600,7 @@ struct ForeignKeysRequest { 2: string parent_tbl_name, 3: string foreign_db_name, 4: string foreign_tbl_name + 5: optional string catName // No cross catalog constraints } struct ForeignKeysResponse { @@ -566,8 +608,9 @@ struct ForeignKeysResponse { } struct UniqueConstraintsRequest { - 1: required string db_name, - 2: required string tbl_name + 1: required string catName, + 2: required string db_name, + 3: required string tbl_name, } struct UniqueConstraintsResponse { @@ -575,8 +618,9 @@ struct UniqueConstraintsResponse { } struct NotNullConstraintsRequest { - 1: required string db_name, - 2: required string tbl_name + 1: required string catName, + 2: required string db_name, + 3: required string tbl_name, } struct NotNullConstraintsResponse { @@ -584,8 +628,9 @@ struct NotNullConstraintsResponse { } struct DefaultConstraintsRequest { - 1: required string db_name, - 2: required string tbl_name + 1: required string catName, + 2: required string db_name, + 3: required string tbl_name } struct DefaultConstraintsResponse { @@ -593,8 +638,9 @@ struct DefaultConstraintsResponse { } struct CheckConstraintsRequest { - 1: required string db_name, - 2: required string tbl_name + 1: required string catName, + 2: required string db_name, + 3: required string tbl_name } struct CheckConstraintsResponse { @@ -605,7 +651,8 @@ struct CheckConstraintsResponse { struct DropConstraintRequest { 1: required string dbname, 2: required string tablename, - 3: required string constraintname + 3: required string constraintname, + 4: optional string catName } struct AddPrimaryKeyRequest { @@ -645,6 +692,7 @@ struct PartitionsByExprRequest { 3: required binary expr, 4: optional string defaultPartitionName, 5: optional i16 maxParts=-1 + 6: optional string catName } struct TableStatsResult { @@ -659,13 +707,15 @@ struct TableStatsRequest { 1: required string dbName, 2: required string tblName, 3: required list<string> colNames + 4: optional string catName } struct PartitionsStatsRequest { 1: required string dbName, 2: required string tblName, 3: required list<string> colNames, - 4: required list<string> partNames + 4: required list<string> partNames, + 5: optional string catName } // Return type for add_partitions_req @@ -679,7 +729,8 @@ struct AddPartitionsRequest { 2: required string tblName, 3: required list<Partition> parts, 4: required bool ifNotExists, - 5: optional bool needResult=true + 5: optional bool needResult=true, + 6: optional string catName } // Return type for drop_partitions_req @@ -707,7 +758,8 @@ struct DropPartitionsRequest { 5: optional bool ifExists=true, // currently verified on client 6: optional bool ignoreProtection, 7: optional EnvironmentContext environmentContext, - 8: optional bool needResult=true + 8: optional bool needResult=true, + 9: optional string catName } struct PartitionValuesRequest { @@ -719,6 +771,7 @@ struct PartitionValuesRequest { 6: optional list<FieldSchema> partitionOrder; 7: optional bool ascending = true; 8: optional i64 maxParts = -1; + 9: optional string catName } struct PartitionValuesRow { @@ -754,6 +807,7 @@ struct Function { 6: i32 createTime, 7: FunctionType functionType, 8: list<ResourceUri> resourceUris, + 9: optional string catName } // Structs for transaction and locks @@ -977,10 +1031,11 @@ struct BasicTxnInfo { } struct CreationMetadata { - 1: required string dbName, - 2: required string tblName, - 3: required set<string> tablesUsed, - 4: optional string validTxnList + 1: required string catName + 2: required string dbName, + 3: required string tblName, + 4: required set<string> tablesUsed, + 5: optional string validTxnList, } struct NotificationEventRequest { @@ -996,6 +1051,7 @@ struct NotificationEvent { 5: optional string tableName, 6: required string message, 7: optional string messageFormat, + 8: optional string catName } struct NotificationEventResponse { @@ -1009,6 +1065,7 @@ struct CurrentNotificationEventId { struct NotificationEventsCountRequest { 1: required i64 fromEventId, 2: required string dbName, + 3: optional string catName } struct NotificationEventsCountResponse { @@ -1034,6 +1091,7 @@ struct FireEventRequest { 3: optional string dbName, 4: optional string tableName, 5: optional list<string> partitionVals, + 6: optional string catName, } struct FireEventResponse { @@ -1125,7 +1183,8 @@ struct ClientCapabilities { struct GetTableRequest { 1: required string dbName, 2: required string tblName, - 3: optional ClientCapabilities capabilities + 3: optional ClientCapabilities capabilities, + 4: optional string catName } struct GetTableResult { @@ -1135,7 +1194,8 @@ struct GetTableResult { struct GetTablesRequest { 1: required string dbName, 2: optional list<string> tblNames, - 3: optional ClientCapabilities capabilities + 3: optional ClientCapabilities capabilities, + 4: optional string catName } struct GetTablesResult { @@ -1157,6 +1217,7 @@ struct TableMeta { 2: required string tableName; 3: required string tableType; 4: optional string comments; + 5: optional string catName; } struct Materialization { @@ -1384,17 +1445,19 @@ struct WMCreateOrDropTriggerToPoolMappingResponse { struct ISchema { 1: SchemaType schemaType, 2: string name, - 3: string dbName, - 4: SchemaCompatibility compatibility, - 5: SchemaValidation validationLevel, - 6: bool canEvolve, - 7: optional string schemaGroup, - 8: optional string description + 3: string catName, + 4: string dbName, + 5: SchemaCompatibility compatibility, + 6: SchemaValidation validationLevel, + 7: bool canEvolve, + 8: optional string schemaGroup, + 9: optional string description } struct ISchemaName { - 1: string dbName, - 2: string schemaName + 1: string catName, + 2: string dbName, + 3: string schemaName } struct AlterISchemaRequest { @@ -1515,6 +1578,11 @@ service ThriftHiveMetastore extends fb303.FacebookService string getMetaConf(1:string key) throws(1:MetaException o1) void setMetaConf(1:string key, 2:string value) throws(1:MetaException o1) + void create_catalog(1: CreateCatalogRequest catalog) throws (1:AlreadyExistsException o1, 2:InvalidObjectException o2, 3: MetaException o3) + GetCatalogResponse get_catalog(1: GetCatalogRequest catName) throws (1:NoSuchObjectException o1, 2:MetaException o2) + GetCatalogsResponse get_catalogs() throws (1:MetaException o1) + void drop_catalog(1: DropCatalogRequest catName) throws (1:NoSuchObjectException o1, 2:InvalidOperationException o2, 3:MetaException o3) + void create_database(1:Database database) throws(1:AlreadyExistsException o1, 2:InvalidObjectException o2, 3:MetaException o3) Database get_database(1:string name) throws(1:NoSuchObjectException o1, 2:MetaException o2) void drop_database(1:string name, 2:bool deleteData, 3:bool cascade) throws(1:NoSuchObjectException o1, 2:InvalidOperationException o2, 3:MetaException o3) @@ -1597,7 +1665,7 @@ service ThriftHiveMetastore extends fb303.FacebookService throws (1:MetaException o1, 2:InvalidOperationException o2, 3:UnknownDBException o3) map<string, Materialization> get_materialization_invalidation_info(1:string dbname, 2:list<string> tbl_names) throws (1:MetaException o1, 2:InvalidOperationException o2, 3:UnknownDBException o3) - void update_creation_metadata(1:string dbname, 2:string tbl_name, 3:CreationMetadata creation_metadata) + void update_creation_metadata(1: string catName, 2:string dbname, 3:string tbl_name, 4:CreationMetadata creation_metadata) throws (1:MetaException o1, 2:InvalidOperationException o2, 3:UnknownDBException o3) // Get a list of table names that match a filter. http://git-wip-us.apache.org/repos/asf/hive/blob/ba8a99e1/standalone-metastore/src/test/java/org/apache/hadoop/hive/metastore/DummyRawStoreControlledCommit.java ---------------------------------------------------------------------- diff --git a/standalone-metastore/src/test/java/org/apache/hadoop/hive/metastore/DummyRawStoreControlledCommit.java b/standalone-metastore/src/test/java/org/apache/hadoop/hive/metastore/DummyRawStoreControlledCommit.java index acad676..304f567 100644 --- a/standalone-metastore/src/test/java/org/apache/hadoop/hive/metastore/DummyRawStoreControlledCommit.java +++ b/standalone-metastore/src/test/java/org/apache/hadoop/hive/metastore/DummyRawStoreControlledCommit.java @@ -21,6 +21,7 @@ package org.apache.hadoop.hive.metastore; import org.apache.hadoop.hive.metastore.api.CreationMetadata; import org.apache.hadoop.hive.metastore.api.ISchemaName; import org.apache.hadoop.hive.metastore.api.SchemaVersionDescriptor; +import org.apache.hadoop.hive.metastore.api.Catalog; import org.apache.hadoop.hive.metastore.api.WMFullResourcePlan; import java.nio.ByteBuffer; @@ -152,36 +153,62 @@ public class DummyRawStoreControlledCommit implements RawStore, Configurable { } @Override + public void createCatalog(Catalog cat) throws MetaException { + objectStore.createCatalog(cat); + } + + @Override + public void alterCatalog(String catName, Catalog cat) throws MetaException, + InvalidOperationException { + objectStore.alterCatalog(catName, cat); + } + + @Override + public Catalog getCatalog(String catalogName) throws NoSuchObjectException, MetaException { + return objectStore.getCatalog(catalogName); + } + + @Override + public List<String> getCatalogs() throws MetaException { + return objectStore.getCatalogs(); + } + + @Override + public void dropCatalog(String catalogName) throws NoSuchObjectException, MetaException { + objectStore.dropCatalog(catalogName); + } + + @Override public void createDatabase(Database db) throws InvalidObjectException, MetaException { objectStore.createDatabase(db); } @Override - public Database getDatabase(String dbName) throws NoSuchObjectException { - return objectStore.getDatabase(dbName); + public Database getDatabase(String catName, String dbName) throws NoSuchObjectException { + return objectStore.getDatabase(catName, dbName); } @Override - public boolean dropDatabase(String dbName) + public boolean dropDatabase(String catName, String dbName) throws NoSuchObjectException, MetaException { - return objectStore.dropDatabase(dbName); + return objectStore.dropDatabase(catName, dbName); } @Override - public boolean alterDatabase(String dbName, Database db) + public boolean alterDatabase(String catName, String dbName, Database db) throws NoSuchObjectException, MetaException { - return objectStore.alterDatabase(dbName, db); + return objectStore.alterDatabase(catName, dbName, db); } @Override - public List<String> getDatabases(String pattern) throws MetaException { - return objectStore.getDatabases(pattern); + public List<String> getDatabases(String catName, String pattern) throws MetaException { + return objectStore.getDatabases(catName, pattern); } @Override - public List<String> getAllDatabases() throws MetaException { - return objectStore.getAllDatabases(); + public List<String> getAllDatabases(String catName) throws MetaException { + return objectStore.getAllDatabases(catName); } @Override @@ -205,15 +232,15 @@ public class DummyRawStoreControlledCommit implements RawStore, Configurable { } @Override - public boolean dropTable(String dbName, String tableName) + public boolean dropTable(String catName, String dbName, String tableName) throws MetaException, NoSuchObjectException, InvalidObjectException, InvalidInputException { - return objectStore.dropTable(dbName, tableName); + return objectStore.dropTable(catName, dbName, tableName); } @Override - public Table getTable(String dbName, String tableName) throws MetaException { - return objectStore.getTable(dbName, tableName); + public Table getTable(String catName, String dbName, String tableName) throws MetaException { + return objectStore.getTable(catName, dbName, tableName); } @Override @@ -223,150 +250,145 @@ public class DummyRawStoreControlledCommit implements RawStore, Configurable { } @Override - public Partition getPartition(String dbName, String tableName, List<String> partVals) + public Partition getPartition(String catName, String dbName, String tableName, List<String> partVals) throws MetaException, NoSuchObjectException { - return objectStore.getPartition(dbName, tableName, partVals); + return objectStore.getPartition(catName, dbName, tableName, partVals); } @Override - public boolean dropPartition(String dbName, String tableName, List<String> partVals) + public boolean dropPartition(String catName, String dbName, String tableName, List<String> partVals) throws MetaException, NoSuchObjectException, InvalidObjectException, InvalidInputException { - return objectStore.dropPartition(dbName, tableName, partVals); + return objectStore.dropPartition(catName, dbName, tableName, partVals); } @Override - public List<Partition> getPartitions(String dbName, String tableName, int max) + public List<Partition> getPartitions(String catName, String dbName, String tableName, int max) throws MetaException, NoSuchObjectException { - return objectStore.getPartitions(dbName, tableName, max); + return objectStore.getPartitions(catName, dbName, tableName, max); } @Override - public void alterTable(String dbName, String name, Table newTable) + public void alterTable(String catName, String dbName, String name, Table newTable) throws InvalidObjectException, MetaException { - objectStore.alterTable(dbName, name, newTable); + objectStore.alterTable(catName, dbName, name, newTable); } @Override - public void updateCreationMetadata(String dbname, String tablename, CreationMetadata cm) + public void updateCreationMetadata(String catName, String dbname, String tablename, CreationMetadata cm) throws MetaException { - objectStore.updateCreationMetadata(dbname, tablename, cm); + objectStore.updateCreationMetadata(catName, dbname, tablename, cm); } - @Override - public List<String> getTables(String dbName, String pattern) throws MetaException { - return objectStore.getTables(dbName, pattern); + public List<String> getTables(String catName, String dbName, String pattern) throws MetaException { + return objectStore.getTables(catName, dbName, pattern); } @Override - public List<String> getTables(String dbName, String pattern, TableType tableType) throws MetaException { - return objectStore.getTables(dbName, pattern, tableType); + public List<String> getTables(String catName, String dbName, String pattern, TableType tableType) throws MetaException { + return objectStore.getTables(catName, dbName, pattern, tableType); } @Override - public List<String> getMaterializedViewsForRewriting(String dbName) + public List<String> getMaterializedViewsForRewriting(String catName, String dbName) throws MetaException, NoSuchObjectException { - return objectStore.getMaterializedViewsForRewriting(dbName); + return objectStore.getMaterializedViewsForRewriting(catName, dbName); } @Override - public List<TableMeta> getTableMeta(String dbNames, String tableNames, List<String> tableTypes) + public List<TableMeta> getTableMeta(String catName, String dbNames, String tableNames, List<String> tableTypes) throws MetaException { - return objectStore.getTableMeta(dbNames, tableNames, tableTypes); + return objectStore.getTableMeta(catName, dbNames, tableNames, tableTypes); } @Override - public List<Table> getTableObjectsByName(String dbName, List<String> tableNames) + public List<Table> getTableObjectsByName(String catName, String dbName, List<String> tableNames) throws MetaException, UnknownDBException { - return objectStore.getTableObjectsByName(dbName, tableNames); + return objectStore.getTableObjectsByName(catName, dbName, tableNames); } @Override - public List<String> getAllTables(String dbName) throws MetaException { - return objectStore.getAllTables(dbName); + public List<String> getAllTables(String catName, String dbName) throws MetaException { + return objectStore.getAllTables(catName, dbName); } @Override - public List<String> listTableNamesByFilter(String dbName, String filter, + public List<String> listTableNamesByFilter(String catName, String dbName, String filter, short maxTables) throws MetaException, UnknownDBException { - return objectStore.listTableNamesByFilter(dbName, filter, maxTables); + return objectStore.listTableNamesByFilter(catName, dbName, filter, maxTables); } @Override - public List<String> listPartitionNames(String dbName, String tblName, short maxParts) + public List<String> listPartitionNames(String catName, String dbName, String tblName, short maxParts) throws MetaException { - return objectStore.listPartitionNames(dbName, tblName, maxParts); + return objectStore.listPartitionNames(catName, dbName, tblName, maxParts); } @Override - public PartitionValuesResponse listPartitionValues(String db_name, String tbl_name, List<FieldSchema> cols, boolean applyDistinct, String filter, boolean ascending, List<FieldSchema> order, long maxParts) throws MetaException { + public PartitionValuesResponse listPartitionValues(String catName, String db_name, + String tbl_name, List<FieldSchema> cols, boolean applyDistinct, String filter, + boolean ascending, List<FieldSchema> order, long maxParts) throws MetaException { return null; } @Override - public List<String> listPartitionNamesByFilter(String dbName, String tblName, - String filter, short maxParts) throws MetaException { - return objectStore.listPartitionNamesByFilter(dbName, tblName, filter, maxParts); - } - - @Override - public void alterPartition(String dbName, String tblName, List<String> partVals, + public void alterPartition(String catName, String dbName, String tblName, List<String> partVals, Partition newPart) throws InvalidObjectException, MetaException { - objectStore.alterPartition(dbName, tblName, partVals, newPart); + objectStore.alterPartition(catName, dbName, tblName, partVals, newPart); } @Override - public void alterPartitions(String dbName, String tblName, + public void alterPartitions(String catName, String dbName, String tblName, List<List<String>> partValsList, List<Partition> newParts) throws InvalidObjectException, MetaException { - objectStore.alterPartitions(dbName, tblName, partValsList, newParts); + objectStore.alterPartitions(catName, dbName, tblName, partValsList, newParts); } @Override - public List<Partition> getPartitionsByFilter(String dbName, String tblName, + public List<Partition> getPartitionsByFilter(String catName, String dbName, String tblName, String filter, short maxParts) throws MetaException, NoSuchObjectException { - return objectStore.getPartitionsByFilter(dbName, tblName, filter, maxParts); + return objectStore.getPartitionsByFilter(catName, dbName, tblName, filter, maxParts); } @Override - public int getNumPartitionsByFilter(String dbName, String tblName, + public int getNumPartitionsByFilter(String catName, String dbName, String tblName, String filter) throws MetaException, NoSuchObjectException { - return objectStore.getNumPartitionsByFilter(dbName, tblName, filter); + return objectStore.getNumPartitionsByFilter(catName, dbName, tblName, filter); } @Override - public int getNumPartitionsByExpr(String dbName, String tblName, + public int getNumPartitionsByExpr(String catName, String dbName, String tblName, byte[] expr) throws MetaException, NoSuchObjectException { - return objectStore.getNumPartitionsByExpr(dbName, tblName, expr); + return objectStore.getNumPartitionsByExpr(catName, dbName, tblName, expr); } @Override - public List<Partition> getPartitionsByNames(String dbName, String tblName, + public List<Partition> getPartitionsByNames(String catName, String dbName, String tblName, List<String> partNames) throws MetaException, NoSuchObjectException { - return objectStore.getPartitionsByNames(dbName, tblName, partNames); + return objectStore.getPartitionsByNames(catName, dbName, tblName, partNames); } @Override - public boolean getPartitionsByExpr(String dbName, String tblName, byte[] expr, + public boolean getPartitionsByExpr(String catName, String dbName, String tblName, byte[] expr, String defaultPartitionName, short maxParts, List<Partition> result) throws TException { - return objectStore.getPartitionsByExpr( + return objectStore.getPartitionsByExpr(catName, dbName, tblName, expr, defaultPartitionName, maxParts, result); } @Override - public Table markPartitionForEvent(String dbName, String tblName, + public Table markPartitionForEvent(String catName, String dbName, String tblName, Map<String, String> partVals, PartitionEventType evtType) throws MetaException, UnknownTableException, InvalidPartitionException, UnknownPartitionException { - return objectStore.markPartitionForEvent(dbName, tblName, partVals, evtType); + return objectStore.markPartitionForEvent(catName, dbName, tblName, partVals, evtType); } @Override - public boolean isPartitionMarkedForEvent(String dbName, String tblName, + public boolean isPartitionMarkedForEvent(String catName, String dbName, String tblName, Map<String, String> partName, PartitionEventType evtType) throws MetaException, UnknownTableException, InvalidPartitionException, UnknownPartitionException { - return objectStore.isPartitionMarkedForEvent(dbName, tblName, partName, evtType); + return objectStore.isPartitionMarkedForEvent(catName, dbName, tblName, partName, evtType); } @Override @@ -402,31 +424,31 @@ public class DummyRawStoreControlledCommit implements RawStore, Configurable { } @Override - public PrincipalPrivilegeSet getDBPrivilegeSet(String dbName, String userName, + public PrincipalPrivilegeSet getDBPrivilegeSet(String catName, String dbName, String userName, List<String> groupNames) throws InvalidObjectException, MetaException { - return objectStore.getDBPrivilegeSet(dbName, userName, groupNames); + return objectStore.getDBPrivilegeSet(catName, dbName, userName, groupNames); } @Override - public PrincipalPrivilegeSet getTablePrivilegeSet(String dbName, String tableName, + public PrincipalPrivilegeSet getTablePrivilegeSet(String catName, String dbName, String tableName, String userName, List<String> groupNames) throws InvalidObjectException, MetaException { - return objectStore.getTablePrivilegeSet(dbName, tableName, userName, groupNames); + return objectStore.getTablePrivilegeSet(catName, dbName, tableName, userName, groupNames); } @Override - public PrincipalPrivilegeSet getPartitionPrivilegeSet(String dbName, String tableName, + public PrincipalPrivilegeSet getPartitionPrivilegeSet(String catName, String dbName, String tableName, String partition, String userName, List<String> groupNames) throws InvalidObjectException, MetaException { - return objectStore.getPartitionPrivilegeSet(dbName, tableName, partition, + return objectStore.getPartitionPrivilegeSet(catName, dbName, tableName, partition, userName, groupNames); } @Override - public PrincipalPrivilegeSet getColumnPrivilegeSet(String dbName, String tableName, + public PrincipalPrivilegeSet getColumnPrivilegeSet(String catName, String dbName, String tableName, String partitionName, String columnName, String userName, List<String> groupNames) throws InvalidObjectException, MetaException { - return objectStore.getColumnPrivilegeSet(dbName, tableName, partitionName, + return objectStore.getColumnPrivilegeSet(catName, dbName, tableName, partitionName, columnName, userName, groupNames); } @@ -438,38 +460,38 @@ public class DummyRawStoreControlledCommit implements RawStore, Configurable { @Override public List<HiveObjectPrivilege> listPrincipalDBGrants(String principalName, - PrincipalType principalType, String dbName) { - return objectStore.listPrincipalDBGrants(principalName, principalType, dbName); + PrincipalType principalType, String catName, String dbName) { + return objectStore.listPrincipalDBGrants(principalName, principalType, catName, dbName); } @Override public List<HiveObjectPrivilege> listAllTableGrants(String principalName, - PrincipalType principalType, String dbName, String tableName) { + PrincipalType principalType, String catName, String dbName, String tableName) { return objectStore.listAllTableGrants(principalName, principalType, - dbName, tableName); + catName, dbName, tableName); } @Override public List<HiveObjectPrivilege> listPrincipalPartitionGrants(String principalName, - PrincipalType principalType, String dbName, String tableName, List<String> partValues, + PrincipalType principalType, String catName, String dbName, String tableName, List<String> partValues, String partName) { return objectStore.listPrincipalPartitionGrants(principalName, principalType, - dbName, tableName, partValues, partName); + catName, dbName, tableName, partValues, partName); } @Override public List<HiveObjectPrivilege> listPrincipalTableColumnGrants(String principalName, - PrincipalType principalType, String dbName, String tableName, String columnName) { + PrincipalType principalType, String catName, String dbName, String tableName, String columnName) { return objectStore.listPrincipalTableColumnGrants(principalName, principalType, - dbName, tableName, columnName); + catName, dbName, tableName, columnName); } @Override public List<HiveObjectPrivilege> listPrincipalPartitionColumnGrants( - String principalName, PrincipalType principalType, String dbName, String tableName, + String principalName, PrincipalType principalType, String catName, String dbName, String tableName, List<String> partVals, String partName, String columnName) { return objectStore.listPrincipalPartitionColumnGrants(principalName, principalType, - dbName, tableName, partVals, partName, columnName); + catName, dbName, tableName, partVals, partName, columnName); } @Override @@ -511,33 +533,33 @@ public class DummyRawStoreControlledCommit implements RawStore, Configurable { } @Override - public Partition getPartitionWithAuth(String dbName, String tblName, + public Partition getPartitionWithAuth(String catName, String dbName, String tblName, List<String> partVals, String userName, List<String> groupNames) throws MetaException, NoSuchObjectException, InvalidObjectException { - return objectStore.getPartitionWithAuth(dbName, tblName, partVals, userName, + return objectStore.getPartitionWithAuth(catName, dbName, tblName, partVals, userName, groupNames); } @Override - public List<Partition> getPartitionsWithAuth(String dbName, String tblName, + public List<Partition> getPartitionsWithAuth(String catName, String dbName, String tblName, short maxParts, String userName, List<String> groupNames) throws MetaException, NoSuchObjectException, InvalidObjectException { - return objectStore.getPartitionsWithAuth(dbName, tblName, maxParts, userName, + return objectStore.getPartitionsWithAuth(catName, dbName, tblName, maxParts, userName, groupNames); } @Override - public List<String> listPartitionNamesPs(String dbName, String tblName, + public List<String> listPartitionNamesPs(String catName, String dbName, String tblName, List<String> partVals, short maxParts) throws MetaException, NoSuchObjectException { - return objectStore.listPartitionNamesPs(dbName, tblName, partVals, maxParts); + return objectStore.listPartitionNamesPs(catName, dbName, tblName, partVals, maxParts); } @Override - public List<Partition> listPartitionsPsWithAuth(String dbName, String tblName, + public List<Partition> listPartitionsPsWithAuth(String catName, String dbName, String tblName, List<String> partVals, short maxParts, String userName, List<String> groupNames) throws MetaException, InvalidObjectException, NoSuchObjectException { - return objectStore.listPartitionsPsWithAuth(dbName, tblName, partVals, maxParts, + return objectStore.listPartitionsPsWithAuth(catName, dbName, tblName, partVals, maxParts, userName, groupNames); } @@ -582,53 +604,52 @@ public class DummyRawStoreControlledCommit implements RawStore, Configurable { } @Override - public List<HiveObjectPrivilege> listDBGrantsAll(String dbName) { - return objectStore.listDBGrantsAll(dbName); + public List<HiveObjectPrivilege> listDBGrantsAll(String catName, String dbName) { + return objectStore.listDBGrantsAll(catName, dbName); } @Override - public List<HiveObjectPrivilege> listPartitionColumnGrantsAll(String dbName, String tableName, + public List<HiveObjectPrivilege> listPartitionColumnGrantsAll(String catName, String dbName, String tableName, String partitionName, String columnName) { - return objectStore.listPartitionColumnGrantsAll(dbName, tableName, partitionName, columnName); + return objectStore.listPartitionColumnGrantsAll(catName, dbName, tableName, partitionName, columnName); } @Override - public List<HiveObjectPrivilege> listTableGrantsAll(String dbName, String tableName) { - return objectStore.listTableGrantsAll(dbName, tableName); + public List<HiveObjectPrivilege> listTableGrantsAll(String catName, String dbName, String tableName) { + return objectStore.listTableGrantsAll(catName, dbName, tableName); } @Override - public List<HiveObjectPrivilege> listPartitionGrantsAll(String dbName, String tableName, + public List<HiveObjectPrivilege> listPartitionGrantsAll(String catName, String dbName, String tableName, String partitionName) { - return objectStore.listPartitionGrantsAll(dbName, tableName, partitionName); + return objectStore.listPartitionGrantsAll(catName, dbName, tableName, partitionName); } @Override - public List<HiveObjectPrivilege> listTableColumnGrantsAll(String dbName, String tableName, + public List<HiveObjectPrivilege> listTableColumnGrantsAll(String catName, String dbName, String tableName, String columnName) { - return objectStore.listTableColumnGrantsAll(dbName, tableName, columnName); + return objectStore.listTableColumnGrantsAll(catName, dbName, tableName, columnName); } @Override - public ColumnStatistics getTableColumnStatistics(String dbName, String tableName, + public ColumnStatistics getTableColumnStatistics(String catName, String dbName, String tableName, List<String> colNames) throws MetaException, NoSuchObjectException { - return objectStore.getTableColumnStatistics(dbName, tableName, colNames); + return objectStore.getTableColumnStatistics(catName, dbName, tableName, colNames); } @Override - public boolean deleteTableColumnStatistics(String dbName, String tableName, - String colName) - throws NoSuchObjectException, MetaException, InvalidObjectException, - InvalidInputException { - return objectStore.deleteTableColumnStatistics(dbName, tableName, colName); + public boolean deleteTableColumnStatistics(String catName, String dbName, String tableName, + String colName) + throws NoSuchObjectException, MetaException, InvalidObjectException, InvalidInputException { + return objectStore.deleteTableColumnStatistics(catName, dbName, tableName, colName); } @Override - public boolean deletePartitionColumnStatistics(String dbName, String tableName, + public boolean deletePartitionColumnStatistics(String catName, String dbName, String tableName, String partName, List<String> partVals, String colName) throws NoSuchObjectException, MetaException, InvalidObjectException, InvalidInputException { - return objectStore.deletePartitionColumnStatistics(dbName, tableName, partName, + return objectStore.deletePartitionColumnStatistics(catName, dbName, tableName, partName, partVals, colName); } @@ -702,33 +723,33 @@ public class DummyRawStoreControlledCommit implements RawStore, Configurable { } @Override - public List<ColumnStatistics> getPartitionColumnStatistics(String dbName, + public List<ColumnStatistics> getPartitionColumnStatistics(String catName, String dbName, String tblName, List<String> colNames, List<String> partNames) throws MetaException, NoSuchObjectException { - return objectStore.getPartitionColumnStatistics(dbName, tblName , colNames, partNames); + return objectStore.getPartitionColumnStatistics(catName, dbName, tblName , colNames, partNames); } @Override - public boolean doesPartitionExist(String dbName, String tableName, + public boolean doesPartitionExist(String catName, String dbName, String tableName, List<String> partVals) throws MetaException, NoSuchObjectException { - return objectStore.doesPartitionExist(dbName, tableName, partVals); + return objectStore.doesPartitionExist(catName, dbName, tableName, partVals); } @Override - public boolean addPartitions(String dbName, String tblName, List<Partition> parts) + public boolean addPartitions(String catName, String dbName, String tblName, List<Partition> parts) throws InvalidObjectException, MetaException { - return objectStore.addPartitions(dbName, tblName, parts); + return objectStore.addPartitions(catName, dbName, tblName, parts); } @Override - public boolean addPartitions(String dbName, String tblName, PartitionSpecProxy partitionSpec, boolean ifNotExists) throws InvalidObjectException, MetaException { + public boolean addPartitions(String catName, String dbName, String tblName, PartitionSpecProxy partitionSpec, boolean ifNotExists) throws InvalidObjectException, MetaException { return false; } @Override - public void dropPartitions(String dbName, String tblName, List<String> partNames) + public void dropPartitions(String catName, String dbName, String tblName, List<String> partNames) throws MetaException, NoSuchObjectException { - objectStore.dropPartitions(dbName, tblName, partNames); + objectStore.dropPartitions(catName, dbName, tblName, partNames); } @Override @@ -738,38 +759,38 @@ public class DummyRawStoreControlledCommit implements RawStore, Configurable { } @Override - public void alterFunction(String dbName, String funcName, Function newFunction) + public void alterFunction(String catName, String dbName, String funcName, Function newFunction) throws InvalidObjectException, MetaException { - objectStore.alterFunction(dbName, funcName, newFunction); + objectStore.alterFunction(catName, dbName, funcName, newFunction); } @Override - public void dropFunction(String dbName, String funcName) + public void dropFunction(String catName, String dbName, String funcName) throws MetaException, NoSuchObjectException, InvalidObjectException, InvalidInputException { - objectStore.dropFunction(dbName, funcName); + objectStore.dropFunction(catName, dbName, funcName); } @Override - public Function getFunction(String dbName, String funcName) + public Function getFunction(String catName, String dbName, String funcName) throws MetaException { - return objectStore.getFunction(dbName, funcName); + return objectStore.getFunction(catName, dbName, funcName); } @Override - public List<Function> getAllFunctions() + public List<Function> getAllFunctions(String catName) throws MetaException { return Collections.emptyList(); } @Override - public List<String> getFunctions(String dbName, String pattern) + public List<String> getFunctions(String catName, String dbName, String pattern) throws MetaException { - return objectStore.getFunctions(dbName, pattern); + return objectStore.getFunctions(catName, dbName, pattern); } @Override - public AggrStats get_aggr_stats_for(String dbName, + public AggrStats get_aggr_stats_for(String catName, String dbName, String tblName, List<String> partNames, List<String> colNames) throws MetaException { return null; @@ -847,14 +868,14 @@ public class DummyRawStoreControlledCommit implements RawStore, Configurable { } @Override - public List<SQLPrimaryKey> getPrimaryKeys(String db_name, String tbl_name) + public List<SQLPrimaryKey> getPrimaryKeys(String catName, String db_name, String tbl_name) throws MetaException { // TODO Auto-generated method stub return null; } @Override - public List<SQLForeignKey> getForeignKeys(String parent_db_name, + public List<SQLForeignKey> getForeignKeys(String catName, String parent_db_name, String parent_tbl_name, String foreign_db_name, String foreign_tbl_name) throws MetaException { // TODO Auto-generated method stub @@ -862,28 +883,28 @@ public class DummyRawStoreControlledCommit implements RawStore, Configurable { } @Override - public List<SQLUniqueConstraint> getUniqueConstraints(String db_name, String tbl_name) + public List<SQLUniqueConstraint> getUniqueConstraints(String catName, String db_name, String tbl_name) throws MetaException { // TODO Auto-generated method stub return null; } @Override - public List<SQLNotNullConstraint> getNotNullConstraints(String db_name, String tbl_name) + public List<SQLNotNullConstraint> getNotNullConstraints(String catName, String db_name, String tbl_name) throws MetaException { // TODO Auto-generated method stub return null; } @Override - public List<SQLDefaultConstraint> getDefaultConstraints(String db_name, String tbl_name) + public List<SQLDefaultConstraint> getDefaultConstraints(String catName, String db_name, String tbl_name) throws MetaException { // TODO Auto-generated method stub return null; } @Override - public List<SQLCheckConstraint> getCheckConstraints(String db_name, String tbl_name) + public List<SQLCheckConstraint> getCheckConstraints(String catName, String db_name, String tbl_name) throws MetaException { // TODO Auto-generated method stub return null; @@ -902,8 +923,8 @@ public class DummyRawStoreControlledCommit implements RawStore, Configurable { } @Override - public void dropConstraint(String dbName, String tableName, - String constraintName) throws NoSuchObjectException { + public void dropConstraint(String catName, String dbName, String tableName, + String constraintName, boolean missingOk) throws NoSuchObjectException { // TODO Auto-generated method stub } @@ -959,7 +980,8 @@ public class DummyRawStoreControlledCommit implements RawStore, Configurable { } @Override - public WMFullResourcePlan getResourcePlan(String name) throws NoSuchObjectException { + public WMFullResourcePlan getResourcePlan(String name) throws NoSuchObjectException, + MetaException { return objectStore.getResourcePlan(name); } @@ -1062,6 +1084,14 @@ public class DummyRawStoreControlledCommit implements RawStore, Configurable { objectStore.dropWMTriggerToPoolMapping(resourcePlanName, triggerName, poolPath); } + + @Override + public List<ColStatsObjWithSourceInfo> getPartitionColStatsForDatabase(String catName, String dbName) + throws MetaException, NoSuchObjectException { + // TODO Auto-generated method stub + return null; + } + public void createISchema(ISchema schema) throws AlreadyExistsException, MetaException, NoSuchObjectException { objectStore.createISchema(schema);
