sql
复制代码
-- ----------------------------
-- Table structure for I_SCHEMA
-- ----------------------------
DROP TABLE IF EXISTS `I_SCHEMA`;
CREATE TABLE `I_SCHEMA` (
`SCHEMA_ID` bigint(20) NOT NULL,
`SCHEMA_TYPE` int(11) NOT NULL,
`NAME` varchar(256) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL,
`DB_ID` bigint(20) NULL DEFAULT NULL,
`COMPATIBILITY` int(11) NOT NULL,
`VALIDATION_LEVEL` int(11) NOT NULL,
`CAN_EVOLVE` bit(1) NOT NULL,
`SCHEMA_GROUP` varchar(256) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL,
`DESCRIPTION` varchar(4000) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL,
PRIMARY KEY (`SCHEMA_ID`) USING BTREE,
INDEX `DB_ID`(`DB_ID`) USING BTREE,
INDEX `UNIQUE_NAME`(`NAME`) USING BTREE,
CONSTRAINT `I_SCHEMA_ibfk_1` FOREIGN KEY (`DB_ID`) REFERENCES `DBS` (`DB_ID`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ENGINE = InnoDB CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for MATERIALIZATION_REBUILD_LOCKS
-- ----------------------------
DROP TABLE IF EXISTS `MATERIALIZATION_REBUILD_LOCKS`;
CREATE TABLE `MATERIALIZATION_REBUILD_LOCKS` (
`MRL_TXN_ID` bigint(20) NOT NULL,
`MRL_DB_NAME` varchar(128) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL,
`MRL_TBL_NAME` varchar(256) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL,
`MRL_LAST_HEARTBEAT` bigint(20) NOT NULL,
PRIMARY KEY (`MRL_TXN_ID`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for METASTORE_DB_PROPERTIES
-- ----------------------------
DROP TABLE IF EXISTS `METASTORE_DB_PROPERTIES`;
CREATE TABLE `METASTORE_DB_PROPERTIES` (
`PROPERTY_KEY` varchar(255) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL,
`PROPERTY_VALUE` varchar(1000) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL,
`DESCRIPTION` varchar(1000) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL,
PRIMARY KEY (`PROPERTY_KEY`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for MIN_HISTORY_LEVEL
-- ----------------------------
DROP TABLE IF EXISTS `MIN_HISTORY_LEVEL`;
CREATE TABLE `MIN_HISTORY_LEVEL` (
`MHL_TXNID` bigint(20) NOT NULL,
`MHL_MIN_OPEN_TXNID` bigint(20) NOT NULL,
PRIMARY KEY (`MHL_TXNID`) USING BTREE,
INDEX `MIN_HISTORY_LEVEL_IDX`(`MHL_MIN_OPEN_TXNID`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for NEXT_WRITE_ID
-- ----------------------------
DROP TABLE IF EXISTS `NEXT_WRITE_ID`;
CREATE TABLE `NEXT_WRITE_ID` (
`NWI_DATABASE` varchar(128) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL,
`NWI_TABLE` varchar(256) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL,
`NWI_NEXT` bigint(20) NOT NULL,
UNIQUE INDEX `NEXT_WRITE_ID_IDX`(`NWI_DATABASE`, `NWI_TABLE`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for REPL_TXN_MAP
-- ----------------------------
DROP TABLE IF EXISTS `REPL_TXN_MAP`;
CREATE TABLE `REPL_TXN_MAP` (
`RTM_REPL_POLICY` varchar(256) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL,
`RTM_SRC_TXN_ID` bigint(20) NOT NULL,
`RTM_TARGET_TXN_ID` bigint(20) NOT NULL,
PRIMARY KEY (`RTM_REPL_POLICY`, `RTM_SRC_TXN_ID`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for RUNTIME_STATS
-- ----------------------------
DROP TABLE IF EXISTS `RUNTIME_STATS`;
CREATE TABLE `RUNTIME_STATS` (
`RS_ID` bigint(20) NOT NULL,
`CREATE_TIME` bigint(20) NOT NULL,
`WEIGHT` bigint(20) NOT NULL,
`PAYLOAD` blob NULL,
PRIMARY KEY (`RS_ID`) USING BTREE,
INDEX `IDX_RUNTIME_STATS_CREATE_TIME`(`CREATE_TIME`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for SCHEMA_VERSION
-- ----------------------------
DROP TABLE IF EXISTS `SCHEMA_VERSION`;
CREATE TABLE `SCHEMA_VERSION` (
`SCHEMA_VERSION_ID` bigint(20) NOT NULL,
`SCHEMA_ID` bigint(20) NULL DEFAULT NULL,
`VERSION` int(11) NOT NULL,
`CREATED_AT` bigint(20) NOT NULL,
`CD_ID` bigint(20) NULL DEFAULT NULL,
`STATE` int(11) NOT NULL,
`DESCRIPTION` varchar(4000) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL,
`SCHEMA_TEXT` mediumtext CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL,
`FINGERPRINT` varchar(256) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL,
`SCHEMA_VERSION_NAME` varchar(256) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL,
`SERDE_ID` bigint(20) NULL DEFAULT NULL,
PRIMARY KEY (`SCHEMA_VERSION_ID`) USING BTREE,
INDEX `CD_ID`(`CD_ID`) USING BTREE,
INDEX `SERDE_ID`(`SERDE_ID`) USING BTREE,
INDEX `UNIQUE_VERSION`(`SCHEMA_ID`, `VERSION`) USING BTREE,
CONSTRAINT `SCHEMA_VERSION_ibfk_1` FOREIGN KEY (`SCHEMA_ID`) REFERENCES `I_SCHEMA` (`SCHEMA_ID`) ON DELETE RESTRICT ON UPDATE RESTRICT,
CONSTRAINT `SCHEMA_VERSION_ibfk_2` FOREIGN KEY (`CD_ID`) REFERENCES `CDS` (`CD_ID`) ON DELETE RESTRICT ON UPDATE RESTRICT,
CONSTRAINT `SCHEMA_VERSION_ibfk_3` FOREIGN KEY (`SERDE_ID`) REFERENCES `SERDES` (`SERDE_ID`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ENGINE = InnoDB CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for TXN_TO_WRITE_ID
-- ----------------------------
DROP TABLE IF EXISTS `TXN_TO_WRITE_ID`;
CREATE TABLE `TXN_TO_WRITE_ID` (
`T2W_TXNID` bigint(20) NOT NULL,
`T2W_DATABASE` varchar(128) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL,
`T2W_TABLE` varchar(256) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL,
`T2W_WRITEID` bigint(20) NOT NULL,
UNIQUE INDEX `TBL_TO_TXN_ID_IDX`(`T2W_DATABASE`, `T2W_TABLE`, `T2W_TXNID`) USING BTREE,
UNIQUE INDEX `TBL_TO_WRITE_ID_IDX`(`T2W_DATABASE`, `T2W_TABLE`, `T2W_WRITEID`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic;
---------------------------------------------------------------------------------------------------------
-- ----------------------------
-- Table structure for WM_MAPPING
-- ----------------------------
DROP TABLE IF EXISTS `WM_MAPPING`;
CREATE TABLE `WM_MAPPING` (
`MAPPING_ID` bigint(20) NOT NULL,
`RP_ID` bigint(20) NOT NULL,
`ENTITY_TYPE` varchar(128) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL,
`ENTITY_NAME` varchar(128) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL,
`POOL_ID` bigint(20) NULL DEFAULT NULL,
`ORDERING` int(11) NULL DEFAULT NULL,
PRIMARY KEY (`MAPPING_ID`) USING BTREE,
UNIQUE INDEX `UNIQUE_WM_MAPPING`(`RP_ID`, `ENTITY_TYPE`, `ENTITY_NAME`) USING BTREE,
INDEX `WM_MAPPING_FK2`(`POOL_ID`) USING BTREE
-- CONSTRAINT `WM_MAPPING_FK1` FOREIGN KEY (`RP_ID`) REFERENCES `WM_RESOURCEPLAN` (`RP_ID`) ON DELETE RESTRICT ON UPDATE RESTRICT,
-- CONSTRAINT `WM_MAPPING_FK2` FOREIGN KEY (`POOL_ID`) REFERENCES `WM_POOL` (`POOL_ID`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ENGINE = InnoDB CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic;
-- ----------------------------
DROP TABLE IF EXISTS `WM_POOL`;
CREATE TABLE `WM_POOL` (
`POOL_ID` bigint(20) NOT NULL,
`RP_ID` bigint(20) NOT NULL,
`PATH` varchar(767) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL,
`ALLOC_FRACTION` double NULL DEFAULT NULL,
`QUERY_PARALLELISM` int(11) NULL DEFAULT NULL,
`SCHEDULING_POLICY` varchar(767) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL,
PRIMARY KEY (`POOL_ID`) USING BTREE,
UNIQUE INDEX `UNIQUE_WM_POOL`(`RP_ID`, `PATH`) USING BTREE
-- CONSTRAINT `WM_POOL_FK1` FOREIGN KEY (`RP_ID`) REFERENCES `WM_RESOURCEPLAN` (`RP_ID`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ENGINE = InnoDB CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for WM_POOL_TO_TRIGGER
-- ----------------------------
DROP TABLE IF EXISTS `WM_POOL_TO_TRIGGER`;
CREATE TABLE `WM_POOL_TO_TRIGGER` (
`POOL_ID` bigint(20) NOT NULL,
`TRIGGER_ID` bigint(20) NOT NULL,
PRIMARY KEY (`POOL_ID`, `TRIGGER_ID`) USING BTREE,
INDEX `WM_POOL_TO_TRIGGER_FK2`(`TRIGGER_ID`) USING BTREE
-- CONSTRAINT `WM_POOL_TO_TRIGGER_FK1` FOREIGN KEY (`POOL_ID`) REFERENCES `WM_POOL` (`POOL_ID`) ON DELETE RESTRICT ON UPDATE RESTRICT,
-- CONSTRAINT `WM_POOL_TO_TRIGGER_FK2` FOREIGN KEY (`TRIGGER_ID`) REFERENCES `WM_TRIGGER` (`TRIGGER_ID`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ENGINE = InnoDB CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for WM_RESOURCEPLAN
-- ----------------------------
DROP TABLE IF EXISTS `WM_RESOURCEPLAN`;
CREATE TABLE `WM_RESOURCEPLAN` (
`RP_ID` bigint(20) NOT NULL,
`NAME` varchar(128) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL,
`QUERY_PARALLELISM` int(11) NULL DEFAULT NULL,
`STATUS` varchar(20) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL,
`DEFAULT_POOL_ID` bigint(20) NULL DEFAULT NULL,
PRIMARY KEY (`RP_ID`) USING BTREE,
UNIQUE INDEX `UNIQUE_WM_RESOURCEPLAN`(`NAME`) USING BTREE,
INDEX `WM_RESOURCEPLAN_FK1`(`DEFAULT_POOL_ID`) USING BTREE
-- CONSTRAINT `WM_RESOURCEPLAN_FK1` FOREIGN KEY (`DEFAULT_POOL_ID`) REFERENCES `WM_POOL` (`POOL_ID`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ENGINE = InnoDB CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for WM_TRIGGER
-- ----------------------------
DROP TABLE IF EXISTS `WM_TRIGGER`;
CREATE TABLE `WM_TRIGGER` (
`TRIGGER_ID` bigint(20) NOT NULL,
`RP_ID` bigint(20) NOT NULL,
`NAME` varchar(128) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL,
`TRIGGER_EXPRESSION` varchar(1024) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL,
`ACTION_EXPRESSION` varchar(1024) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL,
`IS_IN_UNMANAGED` bit(1) NOT NULL DEFAULT b'0',
PRIMARY KEY (`TRIGGER_ID`) USING BTREE,
UNIQUE INDEX `UNIQUE_WM_TRIGGER`(`RP_ID`, `NAME`) USING BTREE
-- CONSTRAINT `WM_TRIGGER_FK1` FOREIGN KEY (`RP_ID`) REFERENCES `WM_RESOURCEPLAN` (`RP_ID`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ENGINE = InnoDB CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic;
-- 添加主键约束
ALTER TABLE WM_MAPPING ADD CONSTRAINT `WM_MAPPING_FK1` FOREIGN KEY (`RP_ID`) REFERENCES `WM_RESOURCEPLAN` (`RP_ID`);
ALTER TABLE WM_MAPPING ADD CONSTRAINT `WM_MAPPING_FK2` FOREIGN KEY (`POOL_ID`) REFERENCES `WM_POOL` (`POOL_ID`);
ALTER TABLE WM_POOL ADD CONSTRAINT WM_POOL_FK1 FOREIGN KEY(RP_ID) REFERENCES `WM_RESOURCEPLAN` (`RP_ID`);
ALTER TABLE WM_POOL_TO_TRIGGER ADD CONSTRAINT `WM_POOL_TO_TRIGGER_FK1` FOREIGN KEY (`POOL_ID`) REFERENCES `WM_POOL` (`POOL_ID`);
ALTER TABLE WM_POOL_TO_TRIGGER ADD CONSTRAINT `WM_POOL_TO_TRIGGER_FK2` FOREIGN KEY (`TRIGGER_ID`) REFERENCES `WM_TRIGGER` (`TRIGGER_ID`);
ALTER TABLE WM_RESOURCEPLAN ADD CONSTRAINT `WM_RESOURCEPLAN_FK1` FOREIGN KEY (`DEFAULT_POOL_ID`) REFERENCES `WM_POOL` (`POOL_ID`);
ALTER TABLE WM_TRIGGER ADD CONSTRAINT `WM_TRIGGER_FK1` FOREIGN KEY (`RP_ID`) REFERENCES `WM_RESOURCEPLAN` (`RP_ID`);
sql
复制代码
-- ----------------------------
-- Table structure for COMPLETED_TXN_COMPONENTS
-- ----------------------------
DROP TABLE IF EXISTS `COMPLETED_TXN_COMPONENTS`;
CREATE TABLE `COMPLETED_TXN_COMPONENTS` (
`CTC_TXNID` bigint(20) NOT NULL,
`CTC_DATABASE` varchar(128) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL,
`CTC_TABLE` varchar(256) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL,
`CTC_PARTITION` varchar(767) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL,
`CTC_TIMESTAMP` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`CTC_WRITEID` bigint(20) NULL DEFAULT NULL,
`CTC_UPDATE_DELETE` char(1) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL,
INDEX `COMPLETED_TXN_COMPONENTS_IDX`(`CTC_DATABASE`, `CTC_TABLE`, `CTC_PARTITION`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for DB_PRIVS
-- ----------------------------
DROP TABLE IF EXISTS `DB_PRIVS`;
CREATE TABLE `DB_PRIVS` (
`DB_GRANT_ID` bigint(20) NOT NULL,
`CREATE_TIME` int(11) NOT NULL,
`DB_ID` bigint(20) NULL DEFAULT NULL,
`GRANT_OPTION` smallint(6) NOT NULL,
`GRANTOR` varchar(128) CHARACTER SET latin1 COLLATE latin1_bin NULL DEFAULT NULL,
`GRANTOR_TYPE` varchar(128) CHARACTER SET latin1 COLLATE latin1_bin NULL DEFAULT NULL,
`PRINCIPAL_NAME` varchar(128) CHARACTER SET latin1 COLLATE latin1_bin NULL DEFAULT NULL,
`PRINCIPAL_TYPE` varchar(128) CHARACTER SET latin1 COLLATE latin1_bin NULL DEFAULT NULL,
`DB_PRIV` varchar(128) CHARACTER SET latin1 COLLATE latin1_bin NULL DEFAULT NULL,
`AUTHORIZER` varchar(128) CHARACTER SET latin1 COLLATE latin1_bin NULL DEFAULT NULL,
PRIMARY KEY (`DB_GRANT_ID`) USING BTREE,
UNIQUE INDEX `DBPRIVILEGEINDEX`(`AUTHORIZER`, `DB_ID`, `PRINCIPAL_NAME`, `PRINCIPAL_TYPE`, `DB_PRIV`, `GRANTOR`, `GRANTOR_TYPE`) USING BTREE,
INDEX `DB_PRIVS_N49`(`DB_ID`) USING BTREE,
CONSTRAINT `DB_PRIVS_FK1` FOREIGN KEY (`DB_ID`) REFERENCES `DBS` (`DB_ID`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ENGINE = InnoDB CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for KEY_CONSTRAINTS
-- ----------------------------
DROP TABLE IF EXISTS `KEY_CONSTRAINTS`;
CREATE TABLE `KEY_CONSTRAINTS` (
`CHILD_CD_ID` bigint(20) NULL DEFAULT NULL,
`CHILD_INTEGER_IDX` int(11) NULL DEFAULT NULL,
`CHILD_TBL_ID` bigint(20) NULL DEFAULT NULL,
`PARENT_CD_ID` bigint(20) NULL DEFAULT NULL,
`PARENT_INTEGER_IDX` int(11) NOT NULL,
`PARENT_TBL_ID` bigint(20) NOT NULL,
`POSITION` bigint(20) NOT NULL,
`CONSTRAINT_NAME` varchar(400) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL,
`CONSTRAINT_TYPE` smallint(6) NOT NULL,
`UPDATE_RULE` smallint(6) NULL DEFAULT NULL,
`DELETE_RULE` smallint(6) NULL DEFAULT NULL,
`ENABLE_VALIDATE_RELY` smallint(6) NOT NULL,
`DEFAULT_VALUE` varchar(400) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL,
PRIMARY KEY (`CONSTRAINT_NAME`, `POSITION`) USING BTREE,
INDEX `CONSTRAINTS_PARENT_TABLE_ID_INDEX`(`PARENT_TBL_ID`) USING BTREE,
INDEX `CONSTRAINTS_CONSTRAINT_TYPE_INDEX`(`CONSTRAINT_TYPE`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for NOTIFICATION_LOG
-- ----------------------------
DROP TABLE IF EXISTS `NOTIFICATION_LOG`;
CREATE TABLE `NOTIFICATION_LOG` (
`NL_ID` bigint(20) NOT NULL,
`EVENT_ID` bigint(20) NOT NULL,
`EVENT_TIME` int(11) NOT NULL,
`EVENT_TYPE` varchar(32) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL,
`CAT_NAME` varchar(256) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL,
`DB_NAME` varchar(128) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL,
`TBL_NAME` varchar(256) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL,
`MESSAGE` longtext CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL,
`MESSAGE_FORMAT` varchar(16) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL,
PRIMARY KEY (`NL_ID`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for PART_COL_PRIVS
-- ----------------------------
DROP TABLE IF EXISTS `PART_COL_PRIVS`;
CREATE TABLE `PART_COL_PRIVS` (
`PART_COLUMN_GRANT_ID` bigint(20) NOT NULL,
`COLUMN_NAME` varchar(767) CHARACTER SET latin1 COLLATE latin1_bin NULL DEFAULT NULL,
`CREATE_TIME` int(11) NOT NULL,
`GRANT_OPTION` smallint(6) NOT NULL,
`GRANTOR` varchar(128) CHARACTER SET latin1 COLLATE latin1_bin NULL DEFAULT NULL,
`GRANTOR_TYPE` varchar(128) CHARACTER SET latin1 COLLATE latin1_bin NULL DEFAULT NULL,
`PART_ID` bigint(20) NULL DEFAULT NULL,
`PRINCIPAL_NAME` varchar(128) CHARACTER SET latin1 COLLATE latin1_bin NULL DEFAULT NULL,
`PRINCIPAL_TYPE` varchar(128) CHARACTER SET latin1 COLLATE latin1_bin NULL DEFAULT NULL,
`PART_COL_PRIV` varchar(128) CHARACTER SET latin1 COLLATE latin1_bin NULL DEFAULT NULL,
`AUTHORIZER` varchar(128) CHARACTER SET latin1 COLLATE latin1_bin NULL DEFAULT NULL,
PRIMARY KEY (`PART_COLUMN_GRANT_ID`) USING BTREE,
INDEX `PART_COL_PRIVS_N49`(`PART_ID`) USING BTREE,
INDEX `PARTITIONCOLUMNPRIVILEGEINDEX`(`AUTHORIZER`, `PART_ID`, `COLUMN_NAME`, `PRINCIPAL_NAME`, `PRINCIPAL_TYPE`, `PART_COL_PRIV`, `GRANTOR`, `GRANTOR_TYPE`) USING BTREE,
CONSTRAINT `PART_COL_PRIVS_FK1` FOREIGN KEY (`PART_ID`) REFERENCES `PARTITIONS` (`PART_ID`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ENGINE = InnoDB CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for PART_COL_STATS
-- ----------------------------
DROP TABLE IF EXISTS `PART_COL_STATS`;
CREATE TABLE `PART_COL_STATS` (
`CS_ID` bigint(20) NOT NULL,
`CAT_NAME` varchar(256) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL DEFAULT 'hive',
`DB_NAME` varchar(128) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL,
`TABLE_NAME` varchar(256) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL,
`PARTITION_NAME` varchar(767) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL,
`COLUMN_NAME` varchar(767) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL,
`COLUMN_TYPE` varchar(128) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL,
`PART_ID` bigint(20) NOT NULL,
`LONG_LOW_VALUE` bigint(20) NULL DEFAULT NULL,
`LONG_HIGH_VALUE` bigint(20) NULL DEFAULT NULL,
`DOUBLE_HIGH_VALUE` double(53, 4) NULL DEFAULT NULL,
`DOUBLE_LOW_VALUE` double(53, 4) NULL DEFAULT NULL,
`BIG_DECIMAL_LOW_VALUE` varchar(4000) CHARACTER SET latin1 COLLATE latin1_bin NULL DEFAULT NULL,
`BIG_DECIMAL_HIGH_VALUE` varchar(4000) CHARACTER SET latin1 COLLATE latin1_bin NULL DEFAULT NULL,
`NUM_NULLS` bigint(20) NOT NULL,
`NUM_DISTINCTS` bigint(20) NULL DEFAULT NULL,
`BIT_VECTOR` blob NULL,
`AVG_COL_LEN` double(53, 4) NULL DEFAULT NULL,
`MAX_COL_LEN` bigint(20) NULL DEFAULT NULL,
`NUM_TRUES` bigint(20) NULL DEFAULT NULL,
`NUM_FALSES` bigint(20) NULL DEFAULT NULL,
`LAST_ANALYZED` bigint(20) NOT NULL,
PRIMARY KEY (`CS_ID`) USING BTREE,
INDEX `PART_COL_STATS_FK`(`PART_ID`) USING BTREE,
INDEX `PCS_STATS_IDX`(`CAT_NAME`, `DB_NAME`, `TABLE_NAME`, `COLUMN_NAME`, `PARTITION_NAME`) USING BTREE,
CONSTRAINT `PART_COL_STATS_FK` FOREIGN KEY (`PART_ID`) REFERENCES `PARTITIONS` (`PART_ID`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ENGINE = InnoDB CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for PART_PRIVS
-- ----------------------------
DROP TABLE IF EXISTS `PART_PRIVS`;
CREATE TABLE `PART_PRIVS` (
`PART_GRANT_ID` bigint(20) NOT NULL,
`CREATE_TIME` int(11) NOT NULL,
`GRANT_OPTION` smallint(6) NOT NULL,
`GRANTOR` varchar(128) CHARACTER SET latin1 COLLATE latin1_bin NULL DEFAULT NULL,
`GRANTOR_TYPE` varchar(128) CHARACTER SET latin1 COLLATE latin1_bin NULL DEFAULT NULL,
`PART_ID` bigint(20) NULL DEFAULT NULL,
`PRINCIPAL_NAME` varchar(128) CHARACTER SET latin1 COLLATE latin1_bin NULL DEFAULT NULL,
`PRINCIPAL_TYPE` varchar(128) CHARACTER SET latin1 COLLATE latin1_bin NULL DEFAULT NULL,
`PART_PRIV` varchar(128) CHARACTER SET latin1 COLLATE latin1_bin NULL DEFAULT NULL,
`AUTHORIZER` varchar(128) CHARACTER SET latin1 COLLATE latin1_bin NULL DEFAULT NULL,
PRIMARY KEY (`PART_GRANT_ID`) USING BTREE,
INDEX `PARTPRIVILEGEINDEX`(`AUTHORIZER`, `PART_ID`, `PRINCIPAL_NAME`, `PRINCIPAL_TYPE`, `PART_PRIV`, `GRANTOR`, `GRANTOR_TYPE`) USING BTREE,
INDEX `PART_PRIVS_N49`(`PART_ID`) USING BTREE,
CONSTRAINT `PART_PRIVS_FK1` FOREIGN KEY (`PART_ID`) REFERENCES `PARTITIONS` (`PART_ID`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ENGINE = InnoDB CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for PARTITION_EVENTS
-- ----------------------------
DROP TABLE IF EXISTS `PARTITION_EVENTS`;
CREATE TABLE `PARTITION_EVENTS` (
`PART_NAME_ID` bigint(20) NOT NULL,
`CAT_NAME` varchar(256) CHARACTER SET latin1 COLLATE latin1_bin NULL DEFAULT NULL,
`DB_NAME` varchar(128) CHARACTER SET latin1 COLLATE latin1_bin NULL DEFAULT NULL,
`EVENT_TIME` bigint(20) NOT NULL,
`EVENT_TYPE` int(11) NOT NULL,
`PARTITION_NAME` varchar(767) CHARACTER SET latin1 COLLATE latin1_bin NULL DEFAULT NULL,
`TBL_NAME` varchar(256) CHARACTER SET latin1 COLLATE latin1_bin NULL DEFAULT NULL,
PRIMARY KEY (`PART_NAME_ID`) USING BTREE,
INDEX `PARTITIONEVENTINDEX`(`PARTITION_NAME`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for TAB_COL_STATS
-- ----------------------------
DROP TABLE IF EXISTS `TAB_COL_STATS`;
CREATE TABLE `TAB_COL_STATS` (
`CS_ID` bigint(20) NOT NULL,
`CAT_NAME` varchar(256) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL DEFAULT 'hive',
`DB_NAME` varchar(128) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL,
`TABLE_NAME` varchar(256) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL,
`COLUMN_NAME` varchar(767) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL,
`COLUMN_TYPE` varchar(128) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL,
`TBL_ID` bigint(20) NOT NULL,
`LONG_LOW_VALUE` bigint(20) NULL DEFAULT NULL,
`LONG_HIGH_VALUE` bigint(20) NULL DEFAULT NULL,
`DOUBLE_HIGH_VALUE` double(53, 4) NULL DEFAULT NULL,
`DOUBLE_LOW_VALUE` double(53, 4) NULL DEFAULT NULL,
`BIG_DECIMAL_LOW_VALUE` varchar(4000) CHARACTER SET latin1 COLLATE latin1_bin NULL DEFAULT NULL,
`BIG_DECIMAL_HIGH_VALUE` varchar(4000) CHARACTER SET latin1 COLLATE latin1_bin NULL DEFAULT NULL,
`NUM_NULLS` bigint(20) NOT NULL,
`NUM_DISTINCTS` bigint(20) NULL DEFAULT NULL,
`BIT_VECTOR` blob NULL,
`AVG_COL_LEN` double(53, 4) NULL DEFAULT NULL,
`MAX_COL_LEN` bigint(20) NULL DEFAULT NULL,
`NUM_TRUES` bigint(20) NULL DEFAULT NULL,
`NUM_FALSES` bigint(20) NULL DEFAULT NULL,
`LAST_ANALYZED` bigint(20) NOT NULL,
PRIMARY KEY (`CS_ID`) USING BTREE,
INDEX `TAB_COL_STATS_FK`(`TBL_ID`) USING BTREE,
INDEX `TAB_COL_STATS_IDX`(`CAT_NAME`, `DB_NAME`, `TABLE_NAME`, `COLUMN_NAME`) USING BTREE,
CONSTRAINT `TAB_COL_STATS_FK` FOREIGN KEY (`TBL_ID`) REFERENCES `TBLS` (`TBL_ID`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ENGINE = InnoDB CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for TBL_COL_PRIVS
-- ----------------------------
DROP TABLE IF EXISTS `TBL_COL_PRIVS`;
CREATE TABLE `TBL_COL_PRIVS` (
`TBL_COLUMN_GRANT_ID` bigint(20) NOT NULL,
`COLUMN_NAME` varchar(767) CHARACTER SET latin1 COLLATE latin1_bin NULL DEFAULT NULL,
`CREATE_TIME` int(11) NOT NULL,
`GRANT_OPTION` smallint(6) NOT NULL,
`GRANTOR` varchar(128) CHARACTER SET latin1 COLLATE latin1_bin NULL DEFAULT NULL,
`GRANTOR_TYPE` varchar(128) CHARACTER SET latin1 COLLATE latin1_bin NULL DEFAULT NULL,
`PRINCIPAL_NAME` varchar(128) CHARACTER SET latin1 COLLATE latin1_bin NULL DEFAULT NULL,
`PRINCIPAL_TYPE` varchar(128) CHARACTER SET latin1 COLLATE latin1_bin NULL DEFAULT NULL,
`TBL_COL_PRIV` varchar(128) CHARACTER SET latin1 COLLATE latin1_bin NULL DEFAULT NULL,
`TBL_ID` bigint(20) NULL DEFAULT NULL,
`AUTHORIZER` varchar(128) CHARACTER SET latin1 COLLATE latin1_bin NULL DEFAULT NULL,
PRIMARY KEY (`TBL_COLUMN_GRANT_ID`) USING BTREE,
INDEX `TABLECOLUMNPRIVILEGEINDEX`(`AUTHORIZER`, `TBL_ID`, `COLUMN_NAME`, `PRINCIPAL_NAME`, `PRINCIPAL_TYPE`, `TBL_COL_PRIV`, `GRANTOR`, `GRANTOR_TYPE`) USING BTREE,
INDEX `TBL_COL_PRIVS_N49`(`TBL_ID`) USING BTREE,
CONSTRAINT `TBL_COL_PRIVS_FK1` FOREIGN KEY (`TBL_ID`) REFERENCES `TBLS` (`TBL_ID`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ENGINE = InnoDB CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for TXN_COMPONENTS
-- ----------------------------
DROP TABLE IF EXISTS `TXN_COMPONENTS`;
CREATE TABLE `TXN_COMPONENTS` (
`TC_TXNID` bigint(20) NOT NULL,
`TC_DATABASE` varchar(128) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL,
`TC_TABLE` varchar(128) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL,
`TC_PARTITION` varchar(767) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL,
`TC_OPERATION_TYPE` char(1) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL,
`TC_WRITEID` bigint(20) NULL DEFAULT NULL,
INDEX `TC_TXNID_INDEX`(`TC_TXNID`) USING BTREE,
CONSTRAINT `TXN_COMPONENTS_ibfk_1` FOREIGN KEY (`TC_TXNID`) REFERENCES `TXNS` (`TXN_ID`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ENGINE = InnoDB CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic;