Aggarwal-Raghav commented on code in PR #6993: URL: https://github.com/apache/hive/pull/6993#discussion_r4723757013
########## standalone-metastore/metastore-server/src/main/sql/hive/upgrade-4.2.0-to-4.3.0.hive.sql: ########## @@ -1,5 +1,149 @@ SELECT 'Upgrading MetaStore schema from 4.2.0 to 4.3.0'; -ALTER TABLE `HIVE_LOCKS` ADD COLUMNS (`HL_CATALOG` string); +USE SYS; Review Comment: Missing `SYS` causes `0: jdbc:hive2://> FAILED: SemanticException [Error 10001]: Table not found default.HIVE_LOCKS` ########## standalone-metastore/metastore-server/src/main/sql/hive/upgrade-4.2.0-to-4.3.0.hive.sql: ########## @@ -1,5 +1,149 @@ SELECT 'Upgrading MetaStore schema from 4.2.0 to 4.3.0'; -ALTER TABLE `HIVE_LOCKS` ADD COLUMNS (`HL_CATALOG` string); Review Comment: Even after `Use SYS;`, `ALTER TABLE ... ADD COLUMNS` fails on `JdbcSerDe` because existing column types get replaced with `"<derived from deserializer>"` as JdbcSerDe is not part of `SERDES_USING_METASTORE_FOR_SCHEMA` conf. Even if by conf tweaking it was made to work, ADD COLUMNS would append `HL_CATALOG` at the end (17 instead of 4 done in HIVE-29244 )but "hive.sql.query" would still select only the old 16 columns from RDBMS. Check this log file: [alter_failure.txt](https://github.com/user-attachments/files/35531754/alter_failure.txt) ########## standalone-metastore/metastore-server/src/main/sql/hive/upgrade-4.2.0-to-4.3.0.hive.sql: ########## @@ -1,5 +1,149 @@ SELECT 'Upgrading MetaStore schema from 4.2.0 to 4.3.0'; -ALTER TABLE `HIVE_LOCKS` ADD COLUMNS (`HL_CATALOG` string); +USE SYS; + +-- HIVE-29244, HIVE-30286 +DROP TABLE IF EXISTS `HIVE_LOCKS`; +CREATE EXTERNAL TABLE `HIVE_LOCKS` ( + `HL_LOCK_EXT_ID` bigint, + `HL_LOCK_INT_ID` bigint, + `HL_TXNID` bigint, + `HL_CATALOG` string, + `HL_DB` string, + `HL_TABLE` string, + `HL_PARTITION` string, + `HL_LOCK_STATE` string, + `HL_LOCK_TYPE` string, + `HL_LAST_HEARTBEAT` bigint, + `HL_ACQUIRED_AT` bigint, + `HL_USER` string, + `HL_HOST` string, + `HL_HEARTBEAT_COUNT` int, + `HL_AGENT_INFO` string, + `HL_BLOCKEDBY_EXT_ID` bigint, + `HL_BLOCKEDBY_INT_ID` bigint +) +STORED BY 'org.apache.hive.storage.jdbc.JdbcStorageHandler' +TBLPROPERTIES ( +"hive.sql.database.type" = "METASTORE", +"hive.sql.query" = +"SELECT + \"HL_LOCK_EXT_ID\", + \"HL_LOCK_INT_ID\", + \"HL_TXNID\", + \"HL_CATALOG\", + \"HL_DB\", + \"HL_TABLE\", + \"HL_PARTITION\", + \"HL_LOCK_STATE\", + \"HL_LOCK_TYPE\", + \"HL_LAST_HEARTBEAT\", + \"HL_ACQUIRED_AT\", + \"HL_USER\", + \"HL_HOST\", + \"HL_HEARTBEAT_COUNT\", + \"HL_AGENT_INFO\", + \"HL_BLOCKEDBY_EXT_ID\", + \"HL_BLOCKEDBY_INT_ID\" +FROM \"HIVE_LOCKS\"" +); + +CREATE OR REPLACE VIEW `LOCKS` ( Review Comment: `SYS.LOCKS` and `INFORMATION_SCHEMA.LOCKS` are recretead as both views had the old 16 columns. I'm **_suspecting_**, in HIVE-29244 it was a miss. Reason: `hive-schema-4.3.0.hive.sql` was updated but `upgrade-4.2.0-to-4.3.0.hive.sql` was not updated for these views. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
