hive3升级

文章目录

    • 一、hive2升级到hive3步骤
      • 1.备份hive2元数据库
      • 2.导入到hive3对应的hive元数据表
      • 3.更新hive_metastore数据表信息
        • 3.1需要新增的表
        • 3.2需要更新字段的表
        • 3.3需要更改数据的表
      • 4.hive3上集群需要的操作
        • 4.1更改元数据对应的库名
        • 4.2重启HiveMetaStore对应服务
    • 二、hive3新特性

一、hive2升级到hive3步骤

1.备份hive2元数据库

mysqldump -h ip -u user-p hive > hive.sql

2.导入到hive3对应的hive元数据表

mysql -h ip -u litbaws -p hive3 < hive3.sql

3.更新hive_metastore数据表信息

3.1需要新增的表

序号hive3
1I_SCHEMA
2MATERIALIZATION_REBUILD_LOCKS
3METASTORE_DB_PROPERTIES
4MIN_HISTORY_LEVEL
5NEXT_WRITE_ID
6REPL_TXN_MAP
7RUNTIME_STATS
8SCHEMA_VERSION
9TXN_TO_WRITE_ID
10WM_MAPPING
11WM_POOL
12WM_POOL_TO_TRIGGER
13WM_RESOURCEPLAN
14WM_TRIGGER
-- ----------------------------
-- 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`);

3.2需要更新字段的表

  • 数据为空的表,删除重建
序号表名hive3hive2备注
1COMPLETED_TXN_COMPONENTS74
2DB_PRIVS109数据库权限
3KEY_CONSTRAINTS1312
4NOTIFICATION_LOG98
5PART_COL_PRIVS1110分区列的授权信息
6PART_COL_STATS2220分区中列的统计信息
7PART_PRIVS109
8PARTITION_EVENTS76
9TAB_COL_STATS2119表中列的统计信息,包括数值类型的最大和最小值
10TBL_COL_PRIVS1110表中列的统计信息,包括数值类型的最大和最小值
11TXN_COMPONENTS65
-- ----------------------------
-- 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;
  • 数据不为空的表
序号表名hive3hive2备注
1DBS76存放数据库信息
2GLOBAL_PRIVS98
3SERDES73hive序列化相关的东西
4TBL_PRIVS109权限表,重点看一下
5TBLS1312
6TXNS109
  • 执行sql
ALTER TABLE `DBS` ADD CTLG_NAME VARCHAR(255) DEFAULT 'hive';
ALTER TABLE `GLOBAL_PRIVS` ADD AUTHORIZER VARCHAR(255) DEFAULT 'SQL';
ALTER TABLE `SERDES` ADD DESCRIPTION	varchar(4000);
ALTER TABLE `SERDES` ADD SERIALIZER_CLASS	varchar(4000);
ALTER TABLE `SERDES` ADD DESERIALIZER_CLASS	varchar(4000);
ALTER TABLE `SERDES` ADD SERDE_TYPE		int(11) DEFAULT 0;
ALTER TABLE `TBL_PRIVS` ADD AUTHORIZER varchar(128) DEFAULT 'SQL';
ALTER TABLE `TBLS` ADD OWNER_TYPE	varchar(10) DEFAULT 'USER';
ALTER TABLE `TXNS` ADD TXN_TYPE	int(11);

3.3需要更改数据的表

  • VERSION需要更改一下版本号

    UPDATE `hive2`.`VERSION` SET `SCHEMA_VERSION` = '3.1.3', `VERSION_COMMENT` = 'Hive release version 3.1.3' WHERE `VER_ID` = 1;
    
  • DBS需要更新数据库对应的路径

UPDATE `hive2`.`DBS` SET `DESC` = NULL, `DB_LOCATION_URI` = 'hdfs://ip-10-5-1-85.ec2.internal:8020/user/hive/warehouse/dyh2.db', `NAME` = 'dyh2', `OWNER_NAME` = 'hadoop', `OWNER_TYPE` = 'USER', `CTLG_NAME` = 'hive' WHERE `DB_ID` = 2;

4.hive3上集群需要的操作

4.1更改元数据对应的库名

  • 修改/etc/hive/conf/hive-site.xml文件
<value>jdbc:mysql://ip:3306/hive_metastore?createDatabaseIfNotExist=true</value>

4.2重启HiveMetaStore对应服务

sudo jps | grep Jar
sudo kill -9 pid

二、hive3新特性

  1. 执行引擎变更为**TEZ**,不使用MR
  2. 成熟的ACID大数据事务支持
  3. LLAP用于妙极,毫秒级查询访问
  4. 基于Apache Ranger的统一权限管理
  5. 默认开启HDFS ACLs
  6. Beeline代替Hive Cli,降低启动开销
  7. 不再支持内嵌Metastore
  8. Spark Catalog不与Hive Catalog集成,但可以互相访问
  9. 批处理使用TEZ,实时查询使用LLAP
  10. Hive3支持联邦查询

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/78254.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

Elasticsearch:什么是生成式人工智能?

生成式人工智能定义 给学生的解释&#xff08;基本&#xff09;&#xff1a; 生成式人工智能是一种可以创造新的原创内容的技术&#xff0c;例如艺术、音乐、软件代码和写作。 当用户输入提示时&#xff0c;人工智能会根据从互联网上现有示例中学到的知识生成响应&#xff0c;…

记录vite下使用require报错和解决办法

前情提要 我们现在项目用的是vite4react18开发的项目、但是最近公司有个睿智的人让我把webpack中的bpmn组件迁移过来、结果就出现问题啦&#xff1a;因为webpack是commonjs规范、但是vite不是、好像是es吧、可想而知各种报错 废话不多说啦 直接上代码&#xff1a; 注释是之前c…

【Spring】手动实现Spring底层机制-问题的引出

&#x1f384;欢迎来到边境矢梦的csdn博文&#x1f384; &#x1f384;本文主要梳理手动实现Spring底层机制-问题的引出 &#x1f384; &#x1f308;我是边境矢梦&#xff0c;一个正在为秋招和算法竞赛做准备的学生&#x1f308; &#x1f386;喜欢的朋友可以关注一下&#x1…

工厂设计模式

github&#xff1a;GitHub - QiuliangLee/pattern: 设计模式 概念 根据产品是具体产品还是具体工厂可分为简单工厂模式和工厂方法模式&#xff0c;根据工厂的抽象程度可分为工厂方法模式和抽象工厂模式。 简单工厂模式、工厂方法模式和抽象工厂模式有何区别&#xff1f; - 知…

一点整理

&#xff08;1&#xff09; 美国在2010年以后开始流行数字化转型的。 在2010年以前&#xff0c; 2006年社交网络FB “YOU”&#xff1a;在2004-2006 Web2.0热之前&#xff0c;企业是无法直接触达到每个消费者的2006年Amazon电子商务&#xff1a;这个是我瞎凑的&#xff0c;但因…

运算放大器学习笔记

目录 一、基本定理二、基本定义三、负反馈电路四、同向放大电路五、反向放大电路六、差分放大电路 一、基本定理 【电路示意图】 开环放大公式 VOAvo(V-V-) 开环放大倍数&#xff08;增益&#xff09;非常大&#xff0c;105 或 106 输入阻抗超级大&#xff08;可以理解为电…

Spring Boot自动装配原理

简介 Spring Boot是一个开源的Java框架&#xff0c;旨在简化Spring应用程序的搭建和开发。它通过自动装配的机制&#xff0c;大大减少了繁琐的配置工作&#xff0c;提高了开发效率。本文将深入探讨Spring Boot的自动装配原理。 自动装配的概述 在传统的Spring框架中&#xf…

八股文学习一(存储)

一. 存储 行式存储的原理与特点 对于 OLAP 场景&#xff0c;大多都是对一整行记录进行增删改查操作的&#xff0c;那么行式存储采用以行的行式在磁盘上存储数据就是一个不错的选择。 当查询基于需求字段查询和返回结果时&#xff0c;由于这些字段都埋藏在各行数据中&#xf…

AcWing 5147. 数量 + 5148. 字符串匹配 - 思维+字符串处理

5147. 数量 这个题是之前某场周赛第三题的中间一个步骤 这里我选择使用递归&#xff0c;因为数据范围是1e9&#xff0c;所以当传入的数字位数超过9为时&#xff0c;即可终止递归。这里只需要传入一个参数dep来表示当前数字有多少位就可以。 但是在这之前&#xff0c;我并没有传…

【Node】Mac多版本Node切换

1、查看当前电脑是否安装node node -v或者查看当前电脑通过brew安装的node路径 ls /usr/local/Cellar/node*2、查看可安装的node brew search node3、安装其他版本node 下载需要安装的node版本 brew install node144、brew切换node版本 假设之前的版本是18&#xff0c;需…

Uniapp学习之从零开始写一个简单的小程序demo(新建页面,通过导航切换页面,发送请求)

先把官网文档摆在这&#xff0c;后面会用到的 [uniapp官网文档]: https://uniapp.dcloud.net.cn/vernacular.html# 一、开发工具准备 1-1 安装HBuilder 按照官方推荐&#xff0c;先装一个HBuilder 下载地址&#xff1a; https://www.dcloud.io/hbuilderx.html1-2 安装微信开…

chrome插件:一个基于webpack + react的chrome 插件项目模板

项目结构 $ tree -L 1 . ├── README.md ├── node_modules # npm依赖 ├── package.json # 详细依赖 ├── pnpm-lock.yaml ├── public # 里边包含dist&#xff0c;安装的时候安装这个目录即可 ├── src …

postgre 12.11单实例安装文档

一 下载 访问https://www.postgresql.org/download/&#xff0c;点击左侧的‘source进行下载&#xff0c;一般选择bz2的安装包。 二 安装 这里安装12.11版本的postgre&#xff0c;数据目录路径为/data/server/pgdata&#xff0c;端口为5432. 2.1 安装依赖包 #安装 yum in…

linux后台开发面试题

网络 网络的字节序网络知识 tcp三次握手 各种细节 timewait状态tcp 与 udp 区别 概念 适用范围TCP四次挥手讲一下过程&#xff0c;最后一次ack如果客户端没收到怎么办&#xff0c;为什么挥手不能只有三次&#xff0c;为什么time_wait。对于socket编程&#xff0c;accept方法是…

C++信息学奥赛1171:大整数的因子

该程序是一个寻找能够整除输入数字的最小正整数的程序。下面是代码的逻辑解析&#xff1a; #include <iostream> #include <string> #include <cstring>using namespace std;int main() {string n; // 定义一个字符串变量nint fale 0; // 用于标记是否能…

Flask-SQLAlchemy 快速上手

原文地址: 在底部查看原文(阅读体验更好) 视频地址: BV1Hh4y1j7jM Flask-SQLAlchemy 是 flask 的一个拓展插件,专门添加对 SQLAlchemy 的支持(ORM,关系对象模型)。使用它可以在 flask 中使用对象直接与 SQLAlchemy 进行交互,大大简化了 SQLAlchemy 与 flask 结合使用的过…

HJ3 随机数

描述 明明生成了NN个1到500之间的随机整数。请你删去其中重复的数字&#xff0c;即相同的数字只保留一个&#xff0c;把其余相同的数去掉&#xff0c;然后再把这些数从小到大排序&#xff0c;按照排好的顺序输出。数据范围&#xff1a; 1≤n≤1000 &#xff0c;输入的数字大小…

企业形象片宣传片策划要从哪里展开

企业形象片宣传片是一种有效的营销工具&#xff0c;能够向潜在客户传达企业的核心价值观、品牌形象和产品服务。对于企业来说&#xff0c;一个成功的宣传片可以增加品牌知名度&#xff0c;提高销售额&#xff0c;并建立与客户的良好关系。然而&#xff0c;要想策划一部成功的企…

换行符转换

将\t\n、\n、多个\n\n\n...转换为\n\n。 import pandas as pd import re # 创建一个示例DataFrame data {msgText: [这是示例文本1&#xff0c;包含\t\n换行符,这是示例文本2&#xff0c;包含\n\n多个\n换行符,这是示例文本3&#xff0c;没有换行符]} df pd.DataFrame(data)…

题目:2833.距离原点最远的点

​​题目来源&#xff1a; leetcode题目&#xff0c;网址&#xff1a;2833. 距离原点最远的点 - 力扣&#xff08;LeetCode&#xff09; 解题思路&#xff1a; 遍历字符串&#xff0c;对 L&#xff0c;R 和 _ 字符计数。前两者计数结果之差的绝对值与 _ 字符的计数结果之和即为…